:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.logo span {
    color: var(--text-primary);
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--primary-color);
}

.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}

.search-box {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    max-width: 700px;
    margin: 0 auto;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.search-input-group {
    display: flex;
    gap: 0.5rem;
}

.search-input-group input {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input-group input:focus {
    border-color: var(--primary-color);
}

.btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.profile-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.profile-option {
    position: relative;
}

.profile-option input {
    position: absolute;
    opacity: 0;
}

.profile-option label {
    display: block;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    color: var(--text-primary);
    background: var(--bg-primary);
    white-space: nowrap;
}

.profile-option input:checked + label {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.profile-option label:hover {
    border-color: var(--primary-color);
}

.metros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 3rem 0;
}

.metro-card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.metro-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.metro-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.metro-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.result-page {
    padding: 2rem 0;
}

.result-header {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.result-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.result-header .profile-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.score-display {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 1.5rem;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.score-circle.buyable {
    background: linear-gradient(135deg, var(--success-color) 0%, #047857 100%);
}

.score-circle.conditional {
    background: linear-gradient(135deg, var(--warning-color) 0%, #b45309 100%);
}

.score-circle.avoid {
    background: linear-gradient(135deg, var(--danger-color) 0%, #b91c1c 100%);
}

.score-number {
    font-size: 2.5rem;
    line-height: 1;
}

.score-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.verdict-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.verdict-info .verdict-text {
    font-size: 1.25rem;
    font-weight: 600;
}

.verdict-text.buyable {
    color: var(--success-color);
}

.verdict-text.conditional {
    color: var(--warning-color);
}

.verdict-text.avoid {
    color: var(--danger-color);
}

.rationale-list {
    list-style: none;
    margin-top: 1rem;
}

.rationale-list li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rationale-list li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

.categories-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
}

.categories-section h2 {
    margin-bottom: 1.5rem;
}

.category-card {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.category-name {
    font-weight: 600;
}

.category-weight {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.category-score {
    font-weight: 700;
    font-size: 1.25rem;
}

.score-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.score-bar-fill.high {
    background: var(--success-color);
}

.score-bar-fill.medium {
    background: var(--warning-color);
}

.score-bar-fill.low {
    background: var(--danger-color);
}

.metric-list {
    font-size: 0.875rem;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.metric-item:last-child {
    border-bottom: none;
}

.metric-name {
    color: var(--text-secondary);
}

.metric-value {
    font-weight: 500;
}

.map-section {
    background: var(--bg-primary);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.map-container {
    height: 400px;
    width: 100%;
}

.zip-scores-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    margin-top: 2rem;
}

.zip-scores-section h2 {
    margin-bottom: 1.5rem;
}

.zip-list {
    display: grid;
    gap: 1rem;
}

.zip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.zip-item:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.zip-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.zip-info p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.zip-score {
    font-size: 1.5rem;
    font-weight: 700;
}

.zip-score.buyable {
    color: var(--success-color);
}

.zip-score.conditional {
    color: var(--warning-color);
}

.zip-score.avoid {
    color: var(--danger-color);
}

.methodology-page {
    padding: 3rem 0;
    max-width: 900px;
    margin: 0 auto;
}

.methodology-page h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

.methodology-section {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.methodology-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.methodology-section h3 {
    font-size: 1.125rem;
    margin: 1.5rem 0 0.75rem;
}

.methodology-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.methodology-section ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.methodology-section li {
    margin-bottom: 0.5rem;
}

.threshold-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.threshold-table th,
.threshold-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.threshold-table th {
    font-weight: 600;
    background: var(--bg-secondary);
}

.profile-card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.profile-card h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.weight-list {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.out-of-scope {
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    padding: 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb span {
    color: var(--text-secondary);
    margin: 0 0.5rem;
}

.error-page {
    text-align: center;
    padding: 4rem 1rem;
}

.error-page h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-page p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
}

footer p {
    opacity: 0.7;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.metric-item:last-child {
    border-bottom: none;
}

.metric-name-col {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.metric-value-col {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.metric-value {
    font-weight: 500;
    min-width: 60px;
    text-align: right;
}

.metric-percentile {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.metric-percentile.high {
    background: rgba(5, 150, 105, 0.15);
    color: var(--success-color);
}

.metric-percentile.medium {
    background: rgba(217, 119, 6, 0.15);
    color: var(--warning-color);
}

.metric-percentile.low {
    background: rgba(220, 38, 38, 0.15);
    color: var(--danger-color);
}

.estimated-badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    background: #fef3c7;
    color: var(--warning-color);
    border-radius: 0.25rem;
    text-transform: uppercase;
}

.source-link {
    font-size: 0.75rem;
    color: var(--primary-color);
    text-decoration: none;
}

.source-link:hover {
    text-decoration: underline;
}

.source-text {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.metric-details {
    margin-top: 1rem;
}

.metric-details summary {
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--primary-color);
    font-weight: 500;
}

.details-content {
    margin-top: 1rem;
    overflow-x: auto;
}

.details-table {
    width: 100%;
    font-size: 0.8rem;
    border-collapse: collapse;
}

.details-table th,
.details-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.details-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.transparency-box {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
}

.transparency-box h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.transparency-box p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.transparency-box ul {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-left: 1rem;
    margin-bottom: 1rem;
}

.methodology-link {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.methodology-link:hover {
    text-decoration: underline;
}

.map-memo-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 1024px) {
    .map-memo-layout {
        grid-template-columns: 1fr;
    }
    
    .map-panel {
        order: -1;
    }
}

.memo-panel {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-right: 1rem;
}

.map-panel {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

.map-container-large {
    width: 100%;
    height: 500px;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.map-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-dot.buyable {
    background: #059669;
}

.legend-dot.conditional {
    background: #d97706;
}

.legend-dot.avoid {
    background: #dc2626;
}

.score-tooltip {
    background: white !important;
    border: none !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15) !important;
    padding: 0 !important;
    border-radius: 0.5rem !important;
}

.score-tooltip .leaflet-tooltip-content {
    margin: 0;
}

.map-tooltip {
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.map-tooltip strong {
    font-size: 0.9rem;
}

.tooltip-label {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    display: inline-block;
}

.tooltip-label.buyable {
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
}

.tooltip-label.conditional {
    background: rgba(217, 119, 6, 0.15);
    color: #d97706;
}

.tooltip-label.avoid {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

.tooltip-score {
    font-size: 1.1rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

.why-section {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: #f0f9ff;
    border-radius: 0.75rem;
    border-left: 4px solid var(--primary-color);
}

.why-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
}

.why-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.why-bullets li {
    padding: 0.4rem 0;
    padding-left: 1.25rem;
    position: relative;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.why-bullets li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.65rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
}

.category-transparency {
    margin-top: 0.75rem;
}

.category-transparency summary {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
}

.category-transparency summary:hover {
    text-decoration: underline;
}

.transparency-content {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.category-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-style: italic;
}

.metric-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-card {
    background: var(--bg-secondary);
    padding: 0.75rem;
    border-radius: 0.5rem;
}

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

.metric-card .metric-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.metric-interpretation {
    font-size: 0.75rem;
    font-weight: 500;
}

.metric-interpretation.strong {
    color: var(--success-color);
}

.metric-interpretation.average {
    color: var(--warning-color);
}

.metric-interpretation.weak {
    color: var(--danger-color);
}

.metric-card-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.metric-percentile-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.metric-percentile-badge.strong {
    background: rgba(5, 150, 105, 0.15);
    color: var(--success-color);
}

.metric-percentile-badge.average {
    background: rgba(217, 119, 6, 0.15);
    color: var(--warning-color);
}

.metric-percentile-badge.weak {
    background: rgba(220, 38, 38, 0.15);
    color: var(--danger-color);
}

.metric-source-link {
    font-size: 0.7rem;
    color: var(--primary-color);
    text-decoration: none;
}

.metric-source-link:hover {
    text-decoration: underline;
}

.metric-source-text {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.raw-value-details {
    margin-top: 0.5rem;
}

.raw-value-details summary {
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.raw-value-content {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    display: flex;
    gap: 0.75rem;
}

.raw-value {
    font-weight: 600;
}

.raw-date {
    color: var(--text-secondary);
}

.missing-data-notice {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border-left: 4px solid var(--warning-color);
    border-radius: 0 0.5rem 0.5rem 0;
}

.missing-data-notice p {
    font-size: 0.85rem;
    color: #92400e;
    margin: 0;
}

.how-calculated-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.how-calculated-section summary {
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.how-calculated-content {
    margin-top: 1rem;
}

.calc-subsection {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.calc-subsection:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.calc-subsection h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.calc-subsection h5 {
    font-size: 0.8rem;
    margin: 0.75rem 0 0.5rem;
    color: var(--text-secondary);
}

.calc-subsection p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.weight-display {
    margin-top: 0.75rem;
}

.weight-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.8rem;
    border-bottom: 1px dotted var(--border-color);
}

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

.weight-value {
    font-weight: 600;
    color: var(--primary-color);
}

.methodology-footer {
    margin-top: 1rem;
    text-align: center;
}

.category-score.strong {
    color: var(--success-color);
}

.category-score.average {
    color: var(--warning-color);
}

.category-score.weak {
    color: var(--danger-color);
}

.intro-section {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 2rem;
}

.intro-text {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.methodology-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.do-section {
    border-left: 4px solid var(--success-color);
}

.dont-section {
    border-left: 4px solid var(--danger-color);
}

.check-list, .x-list {
    list-style: none;
    padding: 0;
}

.check-item, .x-item {
    padding: 0.5rem 0;
    padding-left: 1.75rem;
    position: relative;
    color: var(--text-secondary);
}

.check-item::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.x-item::before {
    content: "\2717";
    position: absolute;
    left: 0;
    color: var(--danger-color);
    font-weight: bold;
}

.examples-box {
    background: #f0f9ff;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

.examples-box h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.examples-box ul {
    margin: 0;
    font-size: 0.9rem;
}

.note-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 1rem;
}

.threshold-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.threshold-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    border-left: 5px solid;
}

.threshold-card.buyable {
    background: rgba(5, 150, 105, 0.08);
    border-color: var(--success-color);
}

.threshold-card.conditional {
    background: rgba(217, 119, 6, 0.08);
    border-color: var(--warning-color);
}

.threshold-card.avoid {
    background: rgba(220, 38, 38, 0.08);
    border-color: var(--danger-color);
}

.threshold-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.threshold-range {
    font-size: 1.25rem;
    font-weight: 700;
}

.threshold-label {
    font-size: 1rem;
    font-weight: 600;
}

.threshold-card.buyable .threshold-label {
    color: var(--success-color);
}

.threshold-card.conditional .threshold-label {
    color: var(--warning-color);
}

.threshold-card.avoid .threshold-label {
    color: var(--danger-color);
}

.threshold-desc {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.threshold-action {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.category-detail-card {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.category-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.category-detail-header h4 {
    font-size: 1.1rem;
    margin: 0;
}

.baseline-weight {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.category-rationale {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.category-metrics h5 {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.category-metrics ul {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.interpretation-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .interpretation-grid {
        grid-template-columns: 1fr;
    }
}

.interpretation-box {
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.interpretation-box.good {
    background: rgba(5, 150, 105, 0.08);
}

.interpretation-box.bad {
    background: rgba(220, 38, 38, 0.08);
}

.interpretation-box strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.interpretation-box p {
    margin: 0;
    color: var(--text-secondary);
}

.example-box {
    background: #f0f9ff;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.note-box {
    background: #fef3c7;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #92400e;
}

.sources-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.sources-table th,
.sources-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.sources-table th {
    background: var(--bg-secondary);
    font-weight: 600;
}

.sources-table a {
    color: var(--primary-color);
}

.disclaimer-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
}

.warning-section {
    background: #fef2f2;
    border-left: 4px solid var(--danger-color);
}

.warning-section h2 {
    color: var(--danger-color);
}

/* Uncertainty and Missing Data Styles */
.uncertainty-notice {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

.uncertainty-notice p {
    margin: 0.25rem 0;
    color: #92400e;
    font-size: 0.9rem;
}

.uncertainty-notice .material-missing {
    font-size: 0.85rem;
    color: #78350f;
}

.missing-badge {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.uncertainty-penalty-badge {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.missing-metric-note {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-style: italic;
}

/* News Context Section */
.ecosystem-maturity-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.ecosystem-maturity-card {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    padding: 1.25rem;
}

.ecosystem-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.ecosystem-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.maturity-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.maturity-badge.high {
    background-color: #dcfce7;
    color: #166534;
}

.maturity-badge.moderate {
    background-color: #fef3c7;
    color: #92400e;
}

.maturity-badge.low {
    background-color: #fee2e2;
    color: #991b1b;
}

.maturity-badge.indeterminate {
    background-color: #e5e7eb;
    color: #6b7280;
}

.ecosystem-descriptor {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.ecosystem-bullets {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.ecosystem-bullets li {
    margin-bottom: 0.375rem;
    line-height: 1.5;
}

.ecosystem-bullets li:last-child {
    margin-bottom: 0;
}

.ecosystem-coverage-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.ecosystem-disclaimer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
    line-height: 1.5;
}

.news-context-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.news-context-details {
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.news-context-summary {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    list-style: none;
}

.news-context-summary::-webkit-details-marker {
    display: none;
}

.news-context-summary::before {
    content: "▶ ";
    font-size: 0.75rem;
    margin-right: 0.5rem;
}

.news-context-details[open] .news-context-summary::before {
    content: "▼ ";
}

.news-context-content {
    padding: 0 1.25rem 1.25rem;
}

.news-disclaimer {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #0369a1;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.news-articles {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.news-article-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    padding: 1rem;
}

.news-headline {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.news-headline:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.news-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.news-source {
    font-weight: 500;
}

.news-date {
    color: var(--text-secondary);
}

/* News Section on Methodology Page */
.news-section .methodology-grid {
    margin-top: 1rem;
}

.philosophy-box {
    background-color: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.philosophy-box strong {
    color: #0369a1;
}

.philosophy-box p {
    margin-top: 0.5rem;
    margin-bottom: 0;
    color: #0c4a6e;
    line-height: 1.6;
}

/* Enhanced City Cards */
.explore-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.explore-header h2 {
    margin: 0;
}

.profile-tabs {
    display: flex;
    gap: 0.5rem;
}

.profile-tab {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.profile-tab:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.profile-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.metro-card.enhanced {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.metro-card.enhanced:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-verdict {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.verdict-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.verdict-badge.buyable {
    background-color: #d1fae5;
    color: #065f46;
}

.verdict-badge.conditional {
    background-color: #fef3c7;
    color: #92400e;
}

.verdict-badge.avoid {
    background-color: #fee2e2;
    color: #991b1b;
}

.verdict-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-signals {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.signal {
    display: flex;
    gap: 0.375rem;
}

.signal-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.signal-value {
    color: var(--text-primary);
}

.signal.strongest .signal-value {
    color: var(--success-color);
}

.signal.weakest .signal-value {
    color: var(--danger-color);
}

.card-zip-teaser {
    display: flex;
    gap: 0.375rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
    margin-bottom: 0.75rem;
}

.zip-range {
    font-weight: 600;
    color: var(--text-primary);
}

.card-cta {
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
}

.metros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.maturity-labels-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.maturity-label-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.maturity-label-item .maturity-badge {
    min-width: 100px;
    text-align: center;
}

.maturity-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.disclaimer-box {
    background-color: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #9a3412;
}

.ecosystem-section h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Tooltip Styles */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    cursor: help;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tooltip-icon:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: #eff6ff;
}

.tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    z-index: 1000;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    padding: 0.75rem;
    background-color: #1f2937;
    color: #f9fafb;
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.5;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-text,
.tooltip-container:focus-within .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Tooltip position adjustments */
.tooltip-right .tooltip-text {
    left: auto;
    right: 0;
    transform: none;
}

.tooltip-right .tooltip-text::after {
    left: auto;
    right: 16px;
    transform: none;
}

.tooltip-left .tooltip-text {
    left: 0;
    transform: none;
}

.tooltip-left .tooltip-text::after {
    left: 16px;
    transform: none;
}

/* Dotted underline tooltip trigger */
.tooltip-underline {
    border-bottom: 1px dotted var(--text-secondary);
    cursor: help;
}

.tooltip-underline:hover {
    border-bottom-color: var(--primary-color);
    color: var(--primary-color);
}

/* Mobile: tap to show */
@media (max-width: 768px) {
    .tooltip-text {
        width: 240px;
        font-size: 0.75rem;
    }
    
    .tooltip-container:active .tooltip-text {
        visibility: visible;
        opacity: 1;
    }
}

/* Profile selector with tooltips */
.profile-btn-container {
    position: relative;
    display: inline-block;
}

.profile-btn-container .tooltip-text {
    width: 240px;
    bottom: calc(100% + 12px);
}

/* Verdict tooltip */
.verdict-tooltip-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.verdict-tooltip-container .tooltip-icon {
    width: 18px;
    height: 18px;
    font-size: 12px;
}

/* Data status tooltips */
.data-status-tooltip {
    display: inline-flex;
    align-items: center;
}

.data-status-tooltip .tooltip-text {
    width: 260px;
}

/* Accessibility: focus styles for tooltip triggers */
.tooltip-icon:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: #eff6ff;
}

.tooltip-container:focus .tooltip-text,
.tooltip-icon:focus + .tooltip-text {
    visibility: visible;
    opacity: 1;
}

[tabindex="0"]:focus + .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.missing-badge:focus,
.estimated-badge:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.missing-badge:focus .tooltip-text,
.estimated-badge:focus .tooltip-text {
    visibility: visible;
    opacity: 1;
}
