/* ============================================
   FiberIntel Design System
   Brand guide: design-a6192a25-b77b-44df-98c1-62fb945e6130
   ============================================ */

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

:root {
    /* Background layers */
    --bg-base:         #0c0d0f;
    --bg-surface:      #131417;
    --bg-surface-hover:#1a1b1f;

    /* Borders */
    --border-muted:    #222428;
    --border-subtle:   rgba(255, 255, 255, 0.04);

    /* Text */
    --text-primary:    #f3f4f6;
    --text-secondary:  #8b909a;
    --text-tertiary:   #5e636e;

    /* Accent — teal */
    --accent-main:          #38b292;
    --accent-main-bg:       rgba(56, 178, 146, 0.15);
    --accent-main-bg-faint: rgba(56, 178, 146, 0.04);

    /* Trend */
    --trend-up:   #38b292;
    --trend-down: #e15b64;

    /* Data series (for map layer colours — unchanged) */
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color:  #ef4444;
    --primary-color: #6366f1;
    --primary-light: #818cf8;

    /* Segment */
    --most-attractive:  #22c55e;
    --neutral:          #f59e0b;
    --least-attractive: #ef4444;

    /* Geometry */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Glass (NPV overlay) */
    --glass-bg:       rgba(10, 12, 16, 0.94);
    --glass-bg-inner: rgba(255, 255, 255, 0.03);
    --glass-border:   1px solid var(--border-muted);
    --glass-blur:     20px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Shared utility classes (mirror brand guide)
   ============================================ */
.label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Header — top nav bar
   ============================================ */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 24px;
    background-color: var(--bg-base);
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
}

header h1 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

header .subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 16px;
}

/* ============================================
   Main layout
   ============================================ */
main {
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ============================================
   Controls Panel
   ============================================ */
.controls-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    animation: fadeSlideIn 0.3s ease forwards;
    animation-delay: 0.05s;
    opacity: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group > label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.toggle-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-muted);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.toggle-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}

.toggle-btn.active {
    background-color: var(--accent-main-bg);
    color: var(--accent-main);
    border-color: var(--accent-main);
    font-weight: 600;
}

.toggle-btn.layer-pending {
    opacity: 0.4;
    font-style: italic;
}

.toggle-btn.layer-pending.active {
    opacity: 0.7;
}

.momentum-pending {
    color: var(--text-tertiary);
    font-style: italic;
}

.filter-group {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-item label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-item select {
    padding: 5px 8px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-muted);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.filter-item select:hover {
    border-color: var(--text-tertiary);
}

.checkbox-item {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.checkbox-item label {
    font-size: 12px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-secondary);
}

/* ============================================
   Content Area
   ============================================ */
.content-area {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* ============================================
   Map Container
   ============================================ */
.map-container {
    flex: 1;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: fadeSlideIn 0.3s ease forwards;
    animation-delay: 0.1s;
    opacity: 0;
    min-width: 0;
}

.map-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background-color: var(--bg-base);
    border-bottom: 1px solid var(--border-muted);
    flex-wrap: wrap;
    gap: 8px;
}

#map-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

#map {
    width: 100%;
    min-height: 520px;
    position: relative;
    background: #0c0d0f;
}

/* ============================================
   Leaflet overrides
   ============================================ */
.leaflet-control-zoom a {
    background: var(--bg-surface) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-muted) !important;
    border-radius: var(--radius-sm) !important;
    font-family: 'Inter', sans-serif;
    transition: all 0.15s ease;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-surface-hover) !important;
    color: var(--text-primary) !important;
}

.leaflet-control-zoom {
    border: 1px solid var(--border-muted) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: none !important;
}

.leaflet-control-attribution {
    background: rgba(12, 13, 15, 0.75) !important;
    color: var(--text-tertiary) !important;
    font-size: 10px !important;
    font-family: 'Inter', sans-serif !important;
    border-radius: 0 !important;
}

.leaflet-control-attribution a {
    color: var(--text-secondary) !important;
}

/* ============================================
   Legend
   ============================================ */
#legend-container {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.legend {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.legend-swatch,
.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   Back Button
   ============================================ */
.back-btn {
    display: none;
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border-muted);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.back-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: var(--text-tertiary);
}

.back-btn.visible {
    display: block;
}

/* ============================================
   Info Panel
   ============================================ */
.info-panel {
    width: 300px;
    flex-shrink: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    max-height: 780px;
    overflow-y: auto;
    animation: fadeSlideIn 0.3s ease forwards;
    animation-delay: 0.15s;
    opacity: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-muted) transparent;
}

.info-panel::-webkit-scrollbar       { width: 4px; }
.info-panel::-webkit-scrollbar-track { background: transparent; }
.info-panel::-webkit-scrollbar-thumb { background: var(--border-muted); border-radius: 4px; }

.info-panel-content {
    padding: 0;
}

/* ============================================
   Default Message
   ============================================ */
.default-message {
    padding: 24px 20px;
}

.default-message h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.default-message p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================
   State Info
   ============================================ */
.state-info {
    padding: 16px 20px;
}

.state-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-muted);
}

/* ============================================
   County Info
   ============================================ */
.pin-indicator {
    background-color: var(--accent-main-bg);
    border-bottom: 1px solid var(--border-muted);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-main);
    letter-spacing: 0.03em;
}

.close-pin-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s ease;
}

.close-pin-btn:hover {
    color: var(--text-primary);
}

.county-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    padding: 14px 20px 10px;
    border-bottom: 1px solid var(--border-muted);
}

/* ============================================
   Score Bars
   ============================================ */
.score-bars {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.score-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.score-bar-item:last-child {
    margin-bottom: 0;
}

.score-bar-item .score-label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 100px;
    flex-shrink: 0;
}

.score-bar {
    flex: 1;
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.score-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--trend-down) 0%, var(--warning-color) 50%, var(--accent-main) 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.score-bar-item .score-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    width: 35px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Stats Sections
   ============================================ */
.stats-section {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.stats-section:last-of-type {
    border-bottom: none;
}

.stats-section h3 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.stat-item {
    background-color: var(--bg-base);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: background-color 0.15s ease;
}

.stat-item:hover {
    background-color: var(--bg-surface-hover);
}

.stat-item .stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-bottom: 3px;
    font-weight: 500;
}

.stat-item .stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.stat-item .stat-value.highlight-opp {
    color: var(--warning-color);
}

.stat-item .stat-value.positive {
    color: var(--trend-up);
}

.stat-item .stat-value.negative {
    color: var(--trend-down);
}

/* Highlighted stat */
.stat-item.stat-highlight {
    background-color: var(--accent-main-bg-faint);
    border: 1px solid rgba(56, 178, 146, 0.2);
    grid-column: span 2;
}

.stat-item.stat-highlight .stat-value {
    color: var(--accent-main);
}

/* ============================================
   Operators Section
   ============================================ */
.operators-section {
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
}

.operators-section h3 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.operators-list {
    list-style: none;
    max-height: 160px;
    overflow-y: auto;
}

.operators-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

.operators-list li:last-child {
    border-bottom: none;
}

.operator-name {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 8px;
    font-weight: 500;
    font-size: 12px;
}

.operator-passings {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   BEAD Status Badge
   ============================================ */
.bead-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-size: 11px !important;
    font-weight: 600;
}

.bead-eligible {
    background: rgba(56, 178, 146, 0.15);
    color: var(--accent-main);
}

.bead-not-eligible {
    background: var(--border-subtle);
    color: var(--text-tertiary);
}

.bead-awarded {
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
}

.bead-in-progress {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
}

.bead-pending {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.bead-not-targeted, .bead-unverified {
    background: var(--border-subtle);
    color: var(--text-tertiary);
}

/* ============================================
   Momentum Indicator
   ============================================ */
.momentum-surging { color: var(--trend-up) !important; font-weight: 600; }
.momentum-growing { color: #6ee7b7 !important; }
.momentum-steady  { color: var(--warning-color) !important; }
.momentum-stalled { color: var(--trend-down) !important; }

/* ============================================
   Click Hint
   ============================================ */
.click-hint {
    margin: 12px 20px;
    padding: 8px 10px;
    background-color: var(--accent-main-bg-faint);
    border: 1px solid rgba(56, 178, 146, 0.15);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
}

.click-hint strong {
    display: block;
    color: var(--accent-main);
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 11px;
}

/* ============================================
   NPV Trigger Button
   ============================================ */
.npv-trigger-btn {
    display: block;
    width: calc(100% - 40px);
    margin: 12px 20px;
    padding: 9px 16px;
    background-color: var(--accent-main-bg);
    color: var(--accent-main);
    border: 1px solid var(--accent-main);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.npv-trigger-btn:hover {
    background-color: var(--accent-main);
    color: var(--bg-base);
}

/* ============================================
   Table Section
   ============================================ */
.table-section {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
    animation: fadeSlideIn 0.3s ease forwards;
    animation-delay: 0.2s;
    opacity: 0;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-muted);
    flex-wrap: wrap;
    gap: 8px;
}

.table-header h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.table-controls input {
    padding: 5px 10px;
    border: 1px solid var(--border-muted);
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    width: 200px;
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease;
}

.table-controls input::placeholder {
    color: var(--text-tertiary);
}

.table-controls input:focus {
    border-color: var(--accent-main);
    outline: none;
}

.table-container {
    overflow-x: auto;
}

#county-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

#county-table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-muted);
    font-weight: 500;
    color: var(--text-tertiary);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background-color: var(--bg-base);
}

#county-table th:hover {
    color: var(--text-primary);
}

#county-table th.sort-asc::after  { content: ' \2191'; color: var(--accent-main); }
#county-table th.sort-desc::after { content: ' \2193'; color: var(--accent-main); }

#county-table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

#county-table tbody tr {
    cursor: pointer;
    transition: background-color 0.12s ease;
}

#county-table tbody tr:hover {
    background-color: var(--bg-surface-hover);
}

#county-table tbody tr.filtered-out {
    display: none;
}

/* ============================================
   Caveats Section
   ============================================ */
.caveats-section {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: var(--radius-lg);
    padding: 20px;
    animation: fadeSlideIn 0.3s ease forwards;
    animation-delay: 0.25s;
    opacity: 0;
}

.caveats-section h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-muted);
    letter-spacing: -0.01em;
}

.caveats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.caveat-item {
    background-color: var(--bg-base);
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.15s ease;
}

.caveat-item:hover {
    border-color: var(--border-muted);
}

.caveat-item h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.caveat-item p {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.caveat-item strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================
   Footer
   ============================================ */
footer {
    background-color: var(--bg-base);
    border-top: 1px solid var(--border-subtle);
    padding: 12px 24px;
    text-align: center;
    margin: 0;
}

footer p {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

footer a:hover {
    color: var(--accent-main);
}

/* ============================================
   NPV Panel
   ============================================ */
.npv-panel {
    position: fixed;
    top: 0;
    right: -440px;
    width: 420px;
    height: 100vh;
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-muted);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.npv-panel.open {
    right: 0;
}

.npv-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background-color: var(--bg-base);
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
}

.npv-panel-header h3 {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.npv-county-label {
    font-size: 12px;
    flex: 1;
    color: var(--text-secondary);
}

.npv-close-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s ease;
}

.npv-close-btn:hover {
    color: var(--text-primary);
}

.npv-panel-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--border-muted) transparent;
}

.npv-panel-body::-webkit-scrollbar       { width: 4px; }
.npv-panel-body::-webkit-scrollbar-track { background: transparent; }
.npv-panel-body::-webkit-scrollbar-thumb { background: var(--border-muted); border-radius: 4px; }

/* ============================================
   NPV Sliders
   ============================================ */
.npv-slider-group {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.npv-slider-group label {
    font-size: 11px;
    color: var(--text-secondary);
    width: 130px;
    flex-shrink: 0;
    font-weight: 500;
}

.npv-slider-group input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-muted);
    border-radius: 2px;
    outline: none;
}

.npv-slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-main);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    box-shadow: 0 0 6px rgba(56, 178, 146, 0.4);
}

.npv-slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-main);
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
}

.npv-slider-val {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    width: 55px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   NPV Results
   ============================================ */
.npv-results {
    margin-top: 16px;
    border-top: 1px solid var(--border-muted);
    padding-top: 16px;
}

.npv-results h4 {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.npv-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.npv-result-item {
    background-color: var(--bg-base);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.npv-result-label {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
    font-weight: 500;
}

.npv-result-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.npv-result-highlight {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 6px;
}

.npv-result-item.big {
    padding: 12px;
    text-align: center;
    background-color: var(--accent-main-bg-faint);
    border: 1px solid rgba(56, 178, 146, 0.2);
}

.npv-result-item.big .npv-result-label {
    font-size: 11px;
    margin-bottom: 4px;
}

.npv-result-item.big .npv-result-value {
    font-size: 20px;
    color: var(--accent-main);
}

.npv-result-value.positive { color: var(--trend-up); }
.npv-result-value.negative { color: var(--trend-down); }

/* ============================================
   Deep Dive Button
   ============================================ */
.deep-dive-btn.active {
    background-color: var(--accent-main-bg) !important;
    color: var(--accent-main) !important;
    border-color: var(--accent-main) !important;
    font-weight: 600 !important;
}

/* ============================================
   Accessibility: Focus
   ============================================ */
:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--accent-main);
    outline-offset: 2px;
    border-radius: 2px;
}

.toggle-btn:focus-visible,
.back-btn:focus-visible,
.close-pin-btn:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-main);
    outline-offset: 2px;
}

#county-table tbody tr:focus-visible {
    outline: 2px solid var(--accent-main);
    outline-offset: -2px;
    background-color: var(--bg-surface-hover);
}

/* ============================================
   Screen Reader Only
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Skip Link
   ============================================ */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-main);
    color: var(--bg-base);
    font-weight: 600;
    padding: 8px 16px;
    z-index: 1000;
    text-decoration: none;
    font-size: 12px;
    border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus { top: 0; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Reduced Motion
   ============================================ */

/* ============================================
   MODE SWITCHER (By Market / By Provider)
   ============================================ */

.mode-switcher {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 12px;
    width: fit-content;
}

.mode-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.mode-btn:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.06);
}

.mode-btn.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 600;
}

/* ============================================
   PROVIDER PICKER — lives in info panel sidebar
   ============================================ */

.provider-picker-panel {
    border-bottom: 1px solid var(--border-muted);
    padding-bottom: 12px;
    margin-bottom: 4px;
}

.provider-picker-header {
    padding: 12px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.provider-picker-title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.provider-search-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    padding: 7px 10px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.provider-search-input::placeholder { color: rgba(255,255,255,0.3); }
.provider-search-input:focus { border-color: rgba(255,255,255,0.3); }

.provider-list-wrap {
    overflow-y: auto;
    max-height: 260px;
    padding: 0 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.12) transparent;
}

.provider-list {
    display: flex;
    flex-direction: column;
}

.provider-group {
    margin-bottom: 4px;
}

.provider-group-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 8px 4px 3px;
}

.provider-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: rgba(255,255,255,0.6);
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    padding: 5px 8px;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    gap: 6px;
}

.provider-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.provider-item.active {
    background: rgba(245, 158, 11, 0.18);
    color: #f59e0b;
    font-weight: 600;
}

.provider-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.provider-item-passings {
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.3);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.provider-item.active .provider-item-passings {
    color: rgba(245, 158, 11, 0.6);
}

/* Tech filter row */
.tech-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.tech-filter-label {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tech-filter-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tech-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 4px;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tech-btn:hover {
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.8);
}

.tech-btn.active {
    background: rgba(245,158,11,0.18);
    border-color: rgba(245,158,11,0.4);
    color: #f59e0b;
}

/* ============================================
   PROVIDER INFO PANEL
   ============================================ */

.provider-info {
    padding: 8px 0;
}

.provider-info-header {
    padding: 0 4px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 12px;
}

.provider-info-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .controls-panel,
    .map-container,
    .info-panel,
    .table-section,
    .caveats-section {
        opacity: 1;
    }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .content-area {
        flex-direction: column;
        align-items: stretch;
    }

    .map-container {
        width: 100%;
    }

    .info-panel {
        width: 100%;
        max-height: none;
    }
}

@media (max-width: 768px) {
    header {
        padding: 10px 16px;
        height: auto;
        min-height: 52px;
        flex-wrap: wrap;
        gap: 2px;
    }

    header h1 {
        font-size: 14px;
    }

    header .subtitle {
        margin-left: 0;
        display: block;
        width: 100%;
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    main {
        padding: 12px;
        gap: 12px;
    }

    .controls-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 10px 12px;
        gap: 12px;
    }

    .toggle-group {
        flex-wrap: wrap;
    }

    .toggle-btn {
        font-size: 11px;
        padding: 4px 9px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    /* Map: proportional height on mobile */
    #map {
        min-height: 320px;
        height: 75vw;
        max-height: 480px;
    }

    .map-header {
        padding: 8px 12px;
        gap: 4px;
    }

    #map-title {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 55vw;
    }

    #legend-container {
        overflow-x: auto;
        max-width: 42vw;
        -webkit-overflow-scrolling: touch;
    }

    .content-area {
        gap: 12px;
    }

    .table-controls input {
        width: 100%;
    }

    .npv-panel {
        width: 100%;
        right: -100%;
    }

    .npv-panel.open {
        right: 0;
    }

    .npv-slider-group {
        flex-wrap: wrap;
    }

    .npv-slider-group label {
        width: 100%;
        margin-bottom: 4px;
    }
}

/* Very small phones */
@media (max-width: 400px) {
    header .subtitle {
        display: none;
    }

    main {
        padding: 8px;
        gap: 8px;
    }

    .controls-panel {
        padding: 8px 10px;
    }

    .toggle-btn {
        font-size: 10px;
        padding: 3px 7px;
    }

    #map {
        min-height: 300px;
        height: 80vw;
        max-height: 400px;
    }
}
