/* ═══════════════════════════════════════════════════════════
   ProAudit Analytics — Global Styles
   Design language: warm, professional, collision-repair industry
   Uses ProAudit brand palette (--pa-primary: #dd9142, --pa-teal: #00a69c)
   ═══════════════════════════════════════════════════════════ */

/* ── Page header ── */
.analytics-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.analytics-page-header .page-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.analytics-page-header .page-title-group h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.01em;
}

.analytics-page-header .page-subtitle {
    font-size: 0.8125rem;
    color: #64748b;
    margin: 0;
}

.analytics-page-header .controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── KPI Cards ── */
.analytics-kpi-card {
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    background: #ffffff !important;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    overflow: hidden;
    position: relative;
}

.analytics-kpi-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06) !important;
    transform: translateY(-1px);
}

.analytics-kpi-card .mud-card-content {
    padding: 1.25rem 1.5rem !important;
}

.analytics-kpi-card .kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin-bottom: 0.375rem;
}

.analytics-kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.analytics-kpi-card .kpi-hidden {
    color: #cbd5e1;
}

.analytics-kpi-card .kpi-change {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 100px;
}

.analytics-kpi-card .kpi-change.positive {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.08);
}

.analytics-kpi-card .kpi-change.negative {
    color: #ef4444;
    background: rgba(220, 38, 38, 0.08);
}

.analytics-kpi-card .kpi-change.neutral {
    color: #64748b;
    background: rgba(100, 116, 139, 0.08);
}

/* Accent stripe on KPI cards */
.analytics-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #dd9142, #e8a96a);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.analytics-kpi-card:hover::before {
    opacity: 1;
}

/* ── Chart Cards ── */
.analytics-chart-card {
    border-radius: 14px;
    border: 1px solid rgba(40,32,20,0.10);
    background: #FDFCFA;
    box-shadow: 0 1px 3px rgba(60,48,30,0.07), 0 4px 14px rgba(60,48,30,0.05);
    padding: 1rem 1rem 0.5rem;
}

.analytics-chart-header {
    font-family: 'Poppins', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1A1612;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0 0.5rem 0.25rem;
}

/* ApexCharts tooltip override */
.apexcharts-tooltip {
    font-family: 'Roboto', sans-serif !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18) !important;
    border: none !important;
}

.apexcharts-tooltip.apexcharts-theme-dark {
    background: #1A1612 !important;
}

.apexcharts-tooltip .apexcharts-tooltip-title {
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 11px !important;
    background: rgba(255,255,255,0.08) !important;
    border-bottom: 1px solid rgba(255,255,255,0.10) !important;
    padding: 6px 10px !important;
}

.apexcharts-tooltip .apexcharts-tooltip-series-group {
    padding: 4px 10px !important;
}

.apexcharts-tooltip .apexcharts-tooltip-text-y-value {
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 600 !important;
    font-size: 13px !important;
}

.apexcharts-tooltip .apexcharts-tooltip-text-y-label {
    font-size: 11px !important;
    opacity: 0.7;
}

/* Crosshair label */
.apexcharts-xaxistooltip {
    display: none !important;
}

/* Legend styling */
.apexcharts-legend-text {
    font-family: 'Roboto', sans-serif !important;
    color: #5C5347 !important;
}

/* ── Score Card ── */
.analytics-score-card {
    border-radius: 16px !important;
    border: none !important;
    background: linear-gradient(135deg, #323232 0%, #404040 100%) !important;
    color: #ffffff !important;
    overflow: hidden;
    position: relative;
}

.analytics-score-card::after {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(221, 145, 66, 0.08);
}

.analytics-score-card .score-main {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
    position: relative;
    z-index: 1;
}

.analytics-score-card .score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    position: relative;
}

.analytics-score-card .score-circle::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
}

.analytics-score-card .score-circle.excellent { background: linear-gradient(135deg, #16a34a, #22c55e); }
.analytics-score-card .score-circle.good { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.analytics-score-card .score-circle.needs-improvement { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.analytics-score-card .score-circle.at-risk { background: linear-gradient(135deg, #ef4444, #ef4444); }

.analytics-score-card .score-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: #ffffff;
}

.analytics-score-card .score-info .score-shop {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

.analytics-score-card .score-tier-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.2rem 0.625rem;
    border-radius: 100px;
    margin-top: 0.375rem;
}

.analytics-score-card .score-tier-badge.excellent { background: rgba(22, 163, 74, 0.2); color: #4ade80; }
.analytics-score-card .score-tier-badge.good { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }
.analytics-score-card .score-tier-badge.needs-improvement { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.analytics-score-card .score-tier-badge.at-risk { background: rgba(220, 38, 38, 0.2); color: #fca5a5; }

.analytics-score-card .score-breakdown {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    z-index: 1;
}

.analytics-score-card .score-breakdown .score-item {
    padding: 0.75rem 1rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.analytics-score-card .score-breakdown .score-item:last-child,
.analytics-score-card .score-breakdown .score-item:nth-child(3) {
    border-right: none;
}

.analytics-score-card .score-breakdown .score-item:nth-child(n+4) {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.analytics-score-card .score-breakdown .score-item-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
}

.analytics-score-card .score-breakdown .score-item-label {
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.125rem;
}

/* ── Leaderboard rank badge ── */
.analytics-rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(221, 145, 66, 0.08), rgba(221, 145, 66, 0.04));
    border: 1px solid rgba(221, 145, 66, 0.2);
}

.analytics-rank-badge .rank-number {
    font-size: 1.25rem;
    font-weight: 800;
    color: #dd9142;
}

.analytics-rank-badge .rank-label {
    font-size: 0.8125rem;
    color: #64748b;
}

/* ── Data Grid styling ── */
.analytics-grid-card {
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    background: #ffffff !important;
    overflow: hidden;
}

.analytics-grid-card .mud-card-header {
    padding: 1rem 1.5rem 0.75rem !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.analytics-grid-card .card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.analytics-grid-card .card-header-row h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #334155;
    margin: 0;
}

.analytics-grid-card .mud-card-content {
    padding: 0 !important;
}

.analytics-grid-card .mud-table-root {
    border: none !important;
}

.analytics-grid-card .mud-table-head th {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.625rem 1rem;
}

.analytics-grid-card .mud-table-body td {
    font-size: 0.8125rem;
    color: #334155;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.analytics-grid-card .mud-table-row:hover {
    background: rgba(221, 145, 66, 0.04) !important;
}

.analytics-grid-card .mud-table-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

/* ── Improvement Area Cards ── */
.improvement-card {
    border-radius: 10px;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.15s ease;
}

.improvement-card:hover {
    background: #f1f5f9;
}

.improvement-card .improvement-category {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.375rem;
}

.improvement-card .improvement-rates {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.improvement-card .rate-value {
    font-size: 0.8125rem;
    font-weight: 600;
}

.improvement-card .rate-value.yours { color: #ef4444; }
.improvement-card .rate-value.avg { color: #16a34a; }

.improvement-card .rate-label {
    font-size: 0.6875rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.improvement-card .improvement-bar {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    margin-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
}

.improvement-card .improvement-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #ef4444, #f97316);
    transition: width 0.4s ease;
}

.improvement-card .improvement-bar-avg {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 10px;
    background: #16a34a;
    border-radius: 1px;
}

.improvement-card .improvement-rec {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
}

/* ── Compliance bar ── */
.compliance-bar-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compliance-bar-cell .compliance-value {
    font-size: 0.8125rem;
    font-weight: 600;
    min-width: 45px;
}

.compliance-bar-cell .compliance-track {
    flex: 1;
    max-width: 120px;
    height: 6px;
    border-radius: 3px;
    background: #e2e8f0;
    overflow: hidden;
}

.compliance-bar-cell .compliance-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.compliance-bar-cell .compliance-fill.high { background: linear-gradient(90deg, #16a34a, #22c55e); }
.compliance-bar-cell .compliance-fill.medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.compliance-bar-cell .compliance-fill.low { background: linear-gradient(90deg, #ef4444, #ef4444); }

/* ── Report Builder ── */
.report-preset-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.report-preset-card {
    border-radius: 12px;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.report-preset-card:hover {
    border-color: rgba(221, 145, 66, 0.3);
    box-shadow: 0 6px 20px rgba(221, 145, 66, 0.1);
    transform: translateY(-2px);
}

.report-preset-card .preset-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(221, 145, 66, 0.08), rgba(221, 145, 66, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    color: #dd9142;
}

.report-preset-card .preset-icon.custom {
    background: linear-gradient(135deg, rgba(0, 166, 156, 0.08), rgba(0, 166, 156, 0.15));
    color: #00a69c;
}

.report-preset-card .preset-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.report-preset-card .preset-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

.report-preset-custom {
    border-style: dashed;
    border-color: rgba(0, 166, 156, 0.3);
}

.report-preset-custom:hover {
    border-color: rgba(0, 166, 156, 0.5);
    box-shadow: 0 6px 20px rgba(0, 166, 156, 0.08);
}

.report-builder-panel {
    border-radius: 12px;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.report-builder-panel .builder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.report-builder-panel .builder-header .analytics-section-header {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.report-results {
    animation: fadeInUp 0.3s ease;
}

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

.nav-tile-icon.reports {
    background: linear-gradient(135deg, rgba(0, 166, 156, 0.1), rgba(0, 166, 156, 0.2));
    color: #00a69c;
}

/* ── Section headers inside pages ── */
.analytics-section-header {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

/* ── Quick nav tiles ── */
.analytics-nav-tile {
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    background: #ffffff !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    padding: 1.25rem !important;
}

.analytics-nav-tile:hover {
    border-color: rgba(221, 145, 66, 0.3) !important;
    box-shadow: 0 4px 12px rgba(221, 145, 66, 0.08) !important;
    transform: translateY(-2px);
}

.analytics-nav-tile .nav-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.25rem;
}

.analytics-nav-tile .nav-tile-icon.compliance { background: rgba(22, 163, 74, 0.08); color: #16a34a; }
.analytics-nav-tile .nav-tile-icon.insurance { background: rgba(14, 165, 233, 0.08); color: #0ea5e9; }
.analytics-nav-tile .nav-tile-icon.vehicles { background: rgba(168, 85, 247, 0.08); color: #a855f7; }

.analytics-nav-tile .nav-tile-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
}

/* ── Benchmark comparison ── */
.benchmark-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.benchmark-row:last-child { border-bottom: none; }

.benchmark-row .benchmark-metric {
    flex: 1;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
}

.benchmark-row .benchmark-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1e293b;
    min-width: 80px;
    text-align: right;
}

.benchmark-row .benchmark-avg {
    font-size: 0.8125rem;
    color: #94a3b8;
    min-width: 80px;
    text-align: right;
}

.benchmark-row .benchmark-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.benchmark-row .benchmark-indicator.above { background: #16a34a; }
.benchmark-row .benchmark-indicator.below { background: #ef4444; }
.benchmark-row .benchmark-indicator.equal { background: #94a3b8; }

/* ── Recent audits table ── */
.recent-audit-vehicle {
    font-weight: 500;
    color: #1e293b;
}

.recent-audit-insurer {
    font-size: 0.75rem;
    color: #94a3b8;
}

.recent-audit-findings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 700;
    background: rgba(221, 145, 66, 0.1);
    color: #dd9142;
}

/* ── Bar chart font size ── */
.analytics-bar-chart svg > g > text,
.analytics-bar-chart .mud-chart-bar .mud-chart-legend-item text {
    font-size: 10px;
}

/* ── Compliance Report Hero ── */
.compliance-hero {
    text-align: center;
    padding: 2.5rem 1rem 2rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.compliance-hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(221, 145, 66, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.compliance-hero-score {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    display: inline-flex;
    align-items: baseline;
    position: relative;
    z-index: 1;
}

.compliance-hero-score .compliance-hero-pct {
    font-size: 1.5rem;
    font-weight: 600;
    margin-left: 0.125rem;
    opacity: 0.7;
}

.compliance-hero-score.hero-high { color: #16a34a; }
.compliance-hero-score.hero-medium { color: #f59e0b; }
.compliance-hero-score.hero-low { color: #ef4444; }

.compliance-hero-label {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-top: 0.5rem;
}

/* ── Compliance Category Cards ── */
.compliance-category-card {
    border-radius: 12px;
    padding: 1.25rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    text-align: center;
    transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.compliance-category-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.compliance-category-card .compliance-category-rate {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.compliance-category-card .compliance-category-rate.high { color: #16a34a; }
.compliance-category-card .compliance-category-rate.medium { color: #f59e0b; }
.compliance-category-card .compliance-category-rate.low { color: #ef4444; }

.compliance-category-card .compliance-category-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    margin: 0.375rem 0 0.75rem;
}

.compliance-category-card .compliance-category-bar {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    overflow: hidden;
}

.compliance-category-card .compliance-category-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.compliance-category-card .compliance-category-fill.high { background: linear-gradient(90deg, #16a34a, #22c55e); }
.compliance-category-card .compliance-category-fill.medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.compliance-category-card .compliance-category-fill.low { background: linear-gradient(90deg, #ef4444, #ef4444); }

/* ── Estimator Leaderboard ── */
.estimator-leaderboard-card {
    border-radius: 12px;
    padding: 0.875rem 1.25rem;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.estimator-leaderboard-card:hover {
    border-color: rgba(221, 145, 66, 0.3);
    box-shadow: 0 4px 16px rgba(221, 145, 66, 0.08);
    transform: translateY(-1px);
}

.estimator-leaderboard-card .rank {
    font-size: 1rem;
    font-weight: 800;
    color: #94a3b8;
    min-width: 28px;
    text-align: center;
}

.estimator-leaderboard-card .rank.rank-1 { color: #dd9142; }
.estimator-leaderboard-card .rank.rank-2 { color: #64748b; }
.estimator-leaderboard-card .rank.rank-3 { color: #b45309; }

.estimator-leaderboard-card .score-pip {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.estimator-leaderboard-card .score-pip.excellent { background: linear-gradient(135deg, #16a34a, #22c55e); }
.estimator-leaderboard-card .score-pip.good { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.estimator-leaderboard-card .score-pip.needs-improvement { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.estimator-leaderboard-card .score-pip.at-risk { background: linear-gradient(135deg, #ef4444, #ef4444); }

.estimator-leaderboard-card .estimator-info {
    flex: 1;
    min-width: 0;
}

.estimator-leaderboard-card .estimator-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.estimator-leaderboard-card .estimator-shop {
    font-size: 0.75rem;
    color: #94a3b8;
}

.estimator-leaderboard-card .estimator-stats {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-shrink: 0;
}

.estimator-leaderboard-card .stat-item {
    text-align: center;
}

.estimator-leaderboard-card .stat-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #1e293b;
}

.estimator-leaderboard-card .stat-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.estimator-leaderboard-card .tier-badge {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.1875rem 0.5rem;
    border-radius: 100px;
    flex-shrink: 0;
}

.estimator-leaderboard-card .tier-badge.excellent { background: rgba(22, 163, 74, 0.1); color: #16a34a; }
.estimator-leaderboard-card .tier-badge.good { background: rgba(14, 165, 233, 0.1); color: #0ea5e9; }
.estimator-leaderboard-card .tier-badge.needs-improvement { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.estimator-leaderboard-card .tier-badge.at-risk { background: rgba(220, 38, 38, 0.1); color: #ef4444; }

.estimator-leaderboard-card .change-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.estimator-leaderboard-card .change-indicator.positive { color: #16a34a; }
.estimator-leaderboard-card .change-indicator.negative { color: #ef4444; }

.analytics-nav-tile .nav-tile-icon.estimators { background: rgba(221, 145, 66, 0.08); color: #dd9142; }

/* ── Labor Hours Breakdown ── */
.labor-hours-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.labor-hours-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.labor-hours-bar-track {
    flex: 1;
    height: 20px;
    border-radius: 4px;
    background: #f1f5f9;
    overflow: hidden;
    min-width: 0;
}

.labor-hours-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    min-width: 2px;
}

.labor-hours-bar-fill.labor-body { background: linear-gradient(90deg, #dd9142, #e8a96a); }
.labor-hours-bar-fill.labor-paint { background: linear-gradient(90deg, #a855f7, #c084fc); }
.labor-hours-bar-fill.labor-structural { background: linear-gradient(90deg, #ef4444, #ef4444); }
.labor-hours-bar-fill.labor-mechanical { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.labor-hours-bar-fill.labor-frame { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.labor-hours-bar-fill.labor-aluminum { background: linear-gradient(90deg, #64748b, #94a3b8); }
.labor-hours-bar-fill.labor-glass { background: linear-gradient(90deg, #00a69c, #2dd4bf); }

.labor-hours-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 220px;
    flex-shrink: 0;
}

.labor-hours-type {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    min-width: 80px;
}

.labor-hours-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #1e293b;
    min-width: 70px;
    text-align: right;
}

.labor-hours-pct {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    min-width: 45px;
    text-align: right;
}

.labor-hours-total {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    font-size: 0.8125rem;
    color: #64748b;
}

.labor-hours-total span:first-child {
    font-weight: 700;
    color: #1e293b;
}

/* ── Estimate Sales Mix ── */
.estimate-mix-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding: 0.5rem 0;
}

.estimate-mix-bars {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.estimate-mix-bar-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.estimate-mix-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #475569;
}

.estimate-mix-bar-label .mix-pct {
    font-weight: 600;
    color: #1e293b;
}

.estimate-mix-bar-track {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}

.estimate-mix-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.estimate-mix-bar-fill.mix-labor { background: linear-gradient(90deg, #dd9142, #e8a96a); }
.estimate-mix-bar-fill.mix-parts { background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.estimate-mix-bar-fill.mix-paint { background: linear-gradient(90deg, #a855f7, #c084fc); }

.estimate-mix-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.estimate-mix-stat {
    text-align: center;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 8px;
}

.estimate-mix-stat .stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.estimate-mix-stat .stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

@media (max-width: 768px) {
    .estimate-mix-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .analytics-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .analytics-score-card .score-breakdown {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 480px) {
    .analytics-score-card .score-breakdown {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════════════
   Shop Performance Dashboard
   Matches ProAudit warm design system. Institutional finance feel.
   ═══════════════════════════════════════════════════════════ */

/* ── Page header ── */
.perf-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 20px;
}

.perf-page-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.375rem;
    font-weight: 700;
    color: #1A1612;
    margin: 0;
    letter-spacing: -0.01em;
}

.perf-page-subtitle {
    font-size: 0.75rem;
    color: #8C8478;
    margin: 2px 0 0;
}

.perf-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Period Selector ── */
.period-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.period-presets {
    display: flex;
    background: #F0EDE7;
    border-radius: 6px;
    padding: 2px;
    gap: 1px;
}

.period-btn {
    font-family: 'Roboto', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #8C8478;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.period-btn:hover {
    color: #5C5347;
    background: rgba(255,255,255,0.5);
}

.period-btn.active {
    background: #FDFCFA;
    color: #1A1612;
    box-shadow: 0 1px 2px rgba(60,48,30,0.10);
}

.period-divider {
    width: 1px;
    height: 20px;
    background: rgba(40,32,20,0.12);
    margin: 0 2px;
}

.period-range {
    display: flex;
    align-items: center;
    gap: 2px;
}

.period-range-sep {
    color: #8C8478;
    font-size: 0.8rem;
    padding: 0 2px;
}

.period-month-select {
    max-width: 68px;
    min-width: 68px;
}

.period-year-select {
    max-width: 64px;
    min-width: 64px;
}

.period-month-select .mud-input-text,
.period-year-select .mud-input-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #1A1612;
    padding: 4px 4px 4px 8px;
}

.period-month-select .mud-select-input,
.period-year-select .mud-select-input {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    padding-top: 2px;
    padding-bottom: 2px;
    min-height: unset;
}

.period-month-select .mud-input-label,
.period-year-select .mud-input-label {
    display: none;
}

.period-month-select .mud-input-adornment-end svg,
.period-year-select .mud-input-adornment-end svg {
    font-size: 0.9rem;
    color: #8C8478;
}

@media (max-width: 768px) {
    .period-selector {
        flex-wrap: wrap;
        gap: 6px;
    }
    .period-divider {
        display: none;
    }
}

/* ── Summary strip ── */
.perf-strip {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
    font-size: 0.8125rem;
    color: #5C5347;
}

.perf-strip-stat {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.perf-strip-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1A1612;
}

.perf-strip-lbl {
    font-size: 0.8125rem;
    color: #5C5347;
    font-weight: 400;
}

.perf-strip-divider {
    width: 1px;
    height: 14px;
    background: rgba(40,32,20,0.18);
    margin: 0 16px;
}

.perf-strip-tier.tier-high { color: #22c55e; }
.perf-strip-tier.tier-good { color: #0284c7; }
.perf-strip-tier.tier-avg { color: #b45309; }
.perf-strip-tier.tier-below { color: #ef4444; }

/* ── Section labels ── */
.perf-section-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8C8478;
    margin: 28px 0 10px;
}

/* ── KPI Grid ── */
.perf-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 4px;
}

.perf-grid-4 { grid-template-columns: repeat(4, 1fr); }
.perf-grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1200px) {
    .perf-grid-4, .perf-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .perf-grid-4, .perf-grid-3 { grid-template-columns: 1fr; }
    .perf-page-header { flex-direction: column; }
    .perf-strip { flex-wrap: wrap; gap: 8px; }
    .perf-strip-divider { display: none; }
}

/* ── Performance KPI Card ── */
.perf-kpi-card {
    background: #FDFCFA;
    border: 1px solid rgba(40,32,20,0.10);
    border-radius: 14px;
    padding: 16px 18px 14px;
    box-shadow: 0 1px 3px rgba(60,48,30,0.07), 0 4px 14px rgba(60,48,30,0.05);
    transition: box-shadow 0.2s;
}

.perf-kpi-card:hover {
    box-shadow: 0 2px 6px rgba(60,48,30,0.10), 0 8px 22px rgba(60,48,30,0.07);
}

/* Row 1: label + tier badge */
.perf-kpi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.perf-kpi-label {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8C8478;
}

/* Row 2: value + change + vs avg (inline) */
.perf-kpi-metrics {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.perf-kpi-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.625rem;
    font-weight: 600;
    color: #1A1612;
    line-height: 1;
    letter-spacing: -0.03em;
}

.perf-kpi-hidden { color: #C4BEB6; }

.perf-kpi-change {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.625rem;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 3px;
}

.perf-kpi-change.positive { color: #22c55e; background: rgba(34,197,94,0.07); }
.perf-kpi-change.negative { color: #ef4444; background: rgba(220,38,38,0.07); }
.perf-kpi-change.neutral { color: #5C5347; background: rgba(60,48,30,0.06); }

/* Inline benchmark reference */
.perf-kpi-vs {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.6875rem;
    color: #8C8478;
    margin-left: auto;
}

.perf-kpi-vs em {
    font-style: normal;
    color: #5C5347;
    font-weight: 500;
}

/* Source citation */
.perf-kpi-source {
    font-size: 0.5625rem;
    color: #8C8478;
    margin-top: 4px;
    font-style: italic;
}

/* ── Tier Badge ── */
.perf-tier-badge {
    font-size: 0.5625rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.perf-tier-badge.tier-high { background: rgba(34,197,94,0.09); color: #22c55e; }
.perf-tier-badge.tier-good { background: rgba(2,132,199,0.09); color: #0284c7; }
.perf-tier-badge.tier-avg { background: rgba(180,83,9,0.09); color: #b45309; }
.perf-tier-badge.tier-below { background: rgba(220,38,38,0.09); color: #ef4444; }

/* ── Tier dot (benchmark table) ── */
.perf-tier-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 8px;
}

.perf-tier-dot.tier-high { background: #22c55e; }
.perf-tier-dot.tier-good { background: #0284c7; }
.perf-tier-dot.tier-avg { background: #b45309; }
.perf-tier-dot.tier-below { background: #ef4444; }

.perf-bench-val {
    display: flex;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: #1A1612;
}

/* ═══════════════════════════════════════════════════════════
   Bullet Chart (Stephen Few)
   - Track: full width, card-alt background
   - Zone overlays: subtle opacity bands for performance ranges
   - Bar: dark charcoal, shorter height, shows actual value
   - Marker: thin vertical line at national average
   ═══════════════════════════════════════════════════════════ */
.perf-bullet {
    position: relative;
    height: 20px;
    margin-bottom: 6px;
}

.perf-bullet-track {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 20px;
    border-radius: 3px;
    background: #F6F4F0;
    overflow: hidden;
}

/* Zone bands — overlaid, progressively lighter toward "better" */
.perf-bullet-zone {
    position: absolute;
    top: 0;
    height: 100%;
}

.perf-bullet-zone.bz-avg  { background: rgba(40,32,20,0.06); }
.perf-bullet-zone.bz-good { background: rgba(40,32,20,0.04); }
.perf-bullet-zone.bz-high { background: rgba(40,32,20,0.025); }

/* Value bar — dark, prominent, shorter for visual hierarchy */
.perf-bullet-bar {
    position: absolute;
    top: 5px; left: 0;
    height: 10px;
    border-radius: 2px;
    background: #3D3630;
    z-index: 2;
    transition: width 0.5s ease;
}

/* Tier-tinted bar */
.perf-kpi-card.tier-high .perf-bullet-bar { background: #34a862; }
.perf-kpi-card.tier-good .perf-bullet-bar { background: #1a6b9c; }
.perf-kpi-card.tier-avg  .perf-bullet-bar { background: #8c6420; }
.perf-kpi-card.tier-below .perf-bullet-bar { background: #d94444; }

/* National average marker — thin vertical line */
.perf-bullet-marker {
    position: absolute;
    top: 1px;
    width: 2px;
    height: 18px;
    background: #1A1612;
    border-radius: 1px;
    z-index: 3;
    opacity: 0.35;
    transform: translateX(-1px);
}

/* Scale labels */
.perf-bullet-scale {
    display: flex;
    justify-content: space-between;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.5625rem;
    color: #8C8478;
    font-weight: 400;
}

/* ── Entrance animation ── */
@keyframes perfFadeUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.perf-kpi-card {
    animation: perfFadeUp 0.3s ease both;
}

.perf-grid .perf-kpi-card:nth-child(1) { animation-delay: 0.02s; }
.perf-grid .perf-kpi-card:nth-child(2) { animation-delay: 0.05s; }
.perf-grid .perf-kpi-card:nth-child(3) { animation-delay: 0.08s; }
.perf-grid .perf-kpi-card:nth-child(4) { animation-delay: 0.11s; }
