:root {
    /* Design 1 Spec Colors */
    --page-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --text-primary: #0F172A;
    --text-body: #374151;
    --text-muted: #6B7280;
    --accent-primary: #2563EB;
    --accent-primary-dark: #1D4ED8;
    --accent-primary-light: #E5EDFF;
    --accent-secondary: #22C55E;
    --border-color: #E5E7EB;

    /* Legacy variables (can be phased out or mapped) */
    --bg: #f5f5f7;
    --bg-card: #ffffff;
    --border-subtle: #e2e4ea;
    --text-main: #111827;
    --accent: #2563eb;
    --accent-light: #eff3ff;
    --accent-dark: #1d4ed8;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-lg: 16px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--page-bg);
    color: var(--text-body);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

a:hover {
    color: var(--accent-primary-dark);
    text-decoration: underline;
}

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

/* New Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
    /* 24px */
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.site-logo img {
    height: 40px;
    width: auto;
}

.data-verified-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--accent-primary);
    background-color: var(--accent-primary-light);
    border-radius: 9999px;
}

/* New Hero Section */
.hero {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
    /* 48px top, 32px bottom */
    max-width: min(1200px, 100% - 3rem);
    margin: 1.5rem auto;
    /* 24px top and bottom margin */
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.hero .hero-copy {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--text-body);
    max-width: 760px;
    margin: 0 auto 1.25rem;
    /* 20px bottom */
}

.hero-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
    /* 48px */
}

.cta-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--accent-primary);
    transition: background-color 0.2s ease;
}

.cta-button:hover {
    background-color: var(--accent-primary-dark);
    color: #ffffff;
    text-decoration: none;
}




/* Responsive adjustments */
@media (max-width: 768px) {
    .site-header {
        padding: 1rem 0;
    }

    .data-verified-pill {
        display: none;
    }

    .hero {
        padding: 2rem 1rem 2.5rem;
        margin: 1rem auto;
    }

    .hero .hero-copy {
        font-size: 1rem;
    }

    .hero-actions {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }

    /* Allow brokerage to wrap on smaller screens */
    .brokerage-cell {
        white-space: normal;
    }

}


/* --- LEGACY STYLES FOR TABLE SECTION --- */
/* (Kept for reference, may need minor tweaks for spacing) */

main {
    display: flex;
    flex-direction: column;
}

.page {
    width: min(1200px, 100% - 3rem);
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.table-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.25rem 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(209, 213, 219, 0.8);
}

.table-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.table-header-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.table-header-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.table-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.legend-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #f3f4f6;
}

.legend-swatch {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #d1d5db;
}

.legend-swatch.primary {
    background: #2563eb;
}

.legend-swatch.secondary {
    background: #4ade80;
}

.table-wrapper {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    background: #ffffff;
    position: relative;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 880px;
    font-size: 0.85rem;
}

thead {
    background: linear-gradient(90deg, #f9fafb, #eef2ff);
}

th,
td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}

th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
    background-clip: padding-box;
}

th.sortable {
    cursor: pointer;
}

th.sortable:hover {
    background-color: rgba(229, 231, 235, 0.6);
}

th .sort-indicator {
    margin-left: 0.25rem;
    font-size: 0.65rem;
    opacity: 0.6;
}

tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

tbody tr:hover {
    background-color: #eef2ff;
}

td {
    border-bottom: 1px solid #f1f5f9;
    color: #111827;
}

td.muted {
    color: var(--text-muted);
    font-size: 0.8rem;
}

td.rank-cell {
    font-weight: 600;
    color: var(--accent-dark);
    font-variant-numeric: tabular-nums;
}

td.numeric {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.pill-small {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: #eef2ff;
    color: #1e40af;
    font-size: 0.72rem;
    font-weight: 500;
}

.pill-small.secondary {
    background: #ecfdf3;
    color: #166534;
}

.neighborhoods {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.neighborhood-chip {
    border-radius: 999px;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    background-color: #f3f4f6;
    color: #4b5563;
}

.status-bar {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.status-highlight {
    font-weight: 500;
    color: #111827;
}

.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px solid #d4d4d8;
    font-size: 0.72rem;
}

/* Contact button */
.contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    border: none;
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.contact-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.contact-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

@media (max-width: 640px) {
    .table-card {
        padding: 1rem 0.75rem 1.1rem;
    }

    .table-header {
        align-items: flex-start;
    }

    .table-wrapper {
        border-radius: 12px;
    }
}

/* Modal styles */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 40;
    padding: 1.2rem;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    max-width: 480px;
    width: 100%;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(209, 213, 219, 0.9);
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #9ca3af;
    padding: 0.1rem;
}

.modal-body {
    padding: 0.85rem 1.25rem 1rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 0.7rem 1.25rem 0.85rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.modal-footer-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.modal-form {
    display: grid;
    gap: 0.65rem;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
}

.field-helper {
    font-size: 0.75rem;
    color: #9ca3af;
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #d1d5db;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
    background: #f9fafb;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.25);
    background: #ffffff;
}

.field-textarea {
    min-height: 70px;
    resize: vertical;
}

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.radio-pill {
    border-radius: 999px;
    border: 1px solid #d4d4d8;
    padding: 0.27rem 0.65rem;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    background: #f9fafb;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.radio-pill input {
    display: none;
}

.radio-pill.active {
    border-color: var(--accent);
    background: #eff6ff;
    color: #1d4ed8;
}

.submit-btn {
    border-radius: 999px;
    border: none;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    white-space: nowrap;
}

.submit-btn:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.checkbox-row input {
    margin-top: 0.18rem;
}

.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;
}