*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
:root {
    /* sourced from tokens.css (editorial design system); page-local names kept */
    --bg: var(--ed-bg);
    --bg2: var(--ed-surface);
    --bg3: var(--ed-surface-2);
    --border: var(--ed-border);
    --gold: var(--ed-gold-soft);
    --gold-solid: var(--ed-gold);
    --gold-dark: var(--ed-gold-dark);
    --accent: var(--ed-gold-soft);
    --accent-solid: var(--ed-gold);
    --text: var(--ed-ink);
    --muted: #6b6b6b;
    --white: #fff;
    --green: var(--ed-green);
    --blue: var(--ed-blue);
    --red: #ef4444;
    --heading: var(--font-heading);
    --body: var(--font-body);
}
body {
    font-family: var(--body);
    font-weight: 400;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
a {
    color: inherit;
    text-decoration: none;
}

/* ── Top Bar ── */
.topbar {
    background: var(--ed-ink);
    color: #fff;
    border-bottom: 0.5px solid #000;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 200;
}
.topbar-brand,
.topbar-brand:link,
.topbar-brand:visited {
    color: #fff !important;
}
.topbar-brand em {
    color: var(--ed-gold) !important;
}
.topbar-links a {
    color: rgba(255, 255, 255, 0.7) !important;
}
.topbar-links a:hover,
.topbar-links a.active {
    color: #fff !important;
}
.topbar-right a {
    color: var(--ed-ink) !important;
    background: var(--ed-gold) !important;
    padding: 7px 16px !important;
}
.topbar-brand {
    font-family: var(--heading);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
    letter-spacing: -0.005em;
}
.topbar-brand img {
    width: 30px;
    height: 30px;
}
.topbar-brand em {
    color: var(--gold-solid);
    font-style: italic;
    font-weight: 600;
}
.topbar-links {
    display: flex;
    gap: 2px;
    margin-left: 20px;
}
.topbar-links a {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 400;
    padding: 6px 12px;
    border-radius: 2px;
    transition: all 0.15s;
    letter-spacing: 0.04em;
}
.topbar-links a:hover,
.topbar-links a.active {
    color: var(--text);
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.topbar-right a {
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--text);
    color: var(--bg);
    padding: 6px 16px;
    border-radius: 2px;
}
/* Logged-in profile chip — replaces Sign In/Up when /me succeeds */
.tb-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 0.5px solid var(--border);
    border-radius: 22px;
    text-decoration: none;
    color: var(--text);
    background: var(--white);
    font-size: 0.78rem;
    font-weight: 500;
    transition: border-color 0.15s;
    cursor: pointer;
}
.tb-profile:hover {
    border-color: var(--accent-solid);
}
.tb-profile .tb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ed-gold), #c4a942);
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.tb-profile .tb-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tb-profile .tb-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tb-menu {
    position: relative;
}
.tb-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: #fff;
    border: 0.5px solid var(--border);
    border-radius: 3px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    padding: 6px 0;
    display: none;
    z-index: 200;
}
.tb-menu.open .tb-dropdown {
    display: block;
}
.tb-dropdown a,
.tb-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 14px;
    font-size: 0.78rem;
    color: var(--text);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
}
.tb-dropdown a:hover,
.tb-dropdown button:hover {
    background: var(--bg3);
    color: var(--accent-solid);
}
.tb-dropdown .sep {
    height: 0.5px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Hero ── */
.hero {
    background: var(--bg);
    padding: 28px 24px 18px;
    text-align: center;
}
.hero h1 {
    font-family: var(--heading);
    font-size: 2rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 4px;
    line-height: 1.15;
}
.hero h1 em {
    color: var(--ed-gold);
    font-style: italic;
    font-weight: 600;
}
.hero p {
    color: #444;
    font-size: 0.88rem;
    font-weight: 400;
    margin-bottom: 16px;
    letter-spacing: 0.01em;
}
.search-wrap {
    max-width: 580px;
    margin: 0 auto;
    position: relative;
}
.search-input {
    width: 100%;
    padding: 14px 18px 14px 46px;
    border: 0.5px solid var(--border);
    border-radius: 2px;
    background: var(--white);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--body);
    font-weight: 300;
    outline: none;
    transition: border-color 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.search-input::placeholder {
    color: #bbb;
    font-weight: 300;
}
.search-input:focus {
    border-color: var(--gold-solid);
}
.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}
.nofee-pill {
    display: inline-block;
    background: rgba(34, 197, 94, 0.08);
    color: var(--green);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 4px 14px;
    border-radius: 2px;
    margin-top: 16px;
    letter-spacing: 0.06em;
}

/* ── Filter Bar ── */
.filter-bar {
    background: var(--white);
    border-bottom: 0.5px solid var(--border);
    padding: 10px 24px;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    position: sticky;
    top: 52px;
    z-index: 150;
}
.fb {
    padding: 7px 14px;
    border: 0.5px solid var(--border);
    border-radius: 2px;
    background: var(--white);
    color: var(--text);
    font-size: 0.75rem;
    font-family: var(--body);
    font-weight: 400;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
}
.fb:hover {
    border-color: var(--text);
}
.fb.on {
    border-color: var(--text);
    background: var(--text);
    color: var(--bg);
}
select.fb {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 28px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23aaa' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.fb-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 300;
}
.fb-reset {
    color: var(--text);
    background: none;
    border: none;
    font-size: 0.72rem;
    cursor: pointer;
    font-family: var(--body);
    font-weight: 400;
    display: none;
    text-decoration: underline;
}
.fb-reset.show {
    display: inline;
}
.source-tab {
    font-weight: 500;
}
.source-tab.on {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

/* Filter controls wrapper. Desktop: invisible box — children flow inline in the
   bar exactly as before. Mobile: a full-screen filter sheet (see the ≤900px
   block). The toggle button, sheet header and "Show results" button are
   mobile-only. */
.fb-controls {
    display: contents;
}
.fb-toggle,
.fb-sheet-head,
.fb-done {
    display: none;
}

/* ── Mobile: collapse all filters behind one button (full-screen sheet) ── */
@media (max-width: 900px) {
    .fb-toggle {
        display: inline-flex;
    }
    .filter-bar {
        gap: 8px;
        flex-wrap: nowrap;
    }
    /* Raised above the topbar (z-index 200) only while the sheet is open. */
    .filter-bar.sheet-open {
        z-index: 500;
    }
    .fb-controls {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 400;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        background: var(--white);
        padding: 0 16px calc(18px + env(safe-area-inset-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .fb-controls.open {
        display: flex;
    }
    .fb-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 1;
        background: var(--white);
        padding: 16px 0 12px;
        border-bottom: 0.5px solid var(--border);
    }
    .fb-sheet-title {
        font-family: var(--heading);
        font-size: 1.5rem;
        font-weight: 600;
    }
    .fb-sheet-close {
        background: none;
        border: 0;
        font-size: 1.9rem;
        line-height: 1;
        color: var(--muted);
        cursor: pointer;
        padding: 0 6px;
    }
    /* Full-width, comfy touch targets, left-aligned labels. */
    .fb-controls .fb,
    .fb-controls select.fb {
        width: 100%;
        min-height: 46px;
        font-size: 16px;
        justify-content: flex-start;
    }
    .fb-controls .source-tabs {
        display: flex;
        gap: 6px;
        width: 100%;
    }
    .fb-controls .source-tabs .fb {
        flex: 1;
        min-width: 0;
        justify-content: center;
        text-align: center;
        padding: 10px 4px;
        font-size: 0.8rem;
    }
    .fb-divider {
        display: none;
    }
    .fb-reset {
        align-self: flex-start;
    }
    .fb-done {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        position: sticky;
        bottom: 0;
        margin-top: 4px;
        min-height: 50px;
        background: var(--text);
        color: var(--bg);
        border: 0;
        border-radius: 2px;
        font-family: var(--body);
        font-size: 0.95rem;
        font-weight: 500;
        cursor: pointer;
    }
}

/* Compare tray — picks 2-3 listings, opens side-by-side modal */
.cta-compare-overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.92);
    color: #444;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    z-index: 2;
    padding: 0;
}
.cta-compare-overlay:hover {
    background: #fff;
}
.cta-compare-overlay.on {
    background: var(--ed-gold);
    color: #fff;
}
#compare-tray {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--ed-ink);
    color: #fff;
    padding: 14px 24px;
    display: none;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.22);
}
#compare-tray.on {
    display: flex;
}
#compare-tray .items {
    display: flex;
    gap: 8px;
    flex: 1;
    overflow-x: auto;
}
#compare-tray .item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    font-size: 0.78rem;
    white-space: nowrap;
}
#compare-tray .item button {
    background: none;
    border: 0;
    color: #fff;
    opacity: 0.6;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0 0 4px;
}
#compare-tray .open-btn {
    padding: 9px 16px;
    background: var(--ed-gold);
    color: #fff;
    border: 0;
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
}
@media (max-width: 680px) {
    #compare-tray {
        padding: 10px 12px;
        font-size: 0.78rem;
    }
    #compare-tray .item {
        padding: 5px 8px;
        font-size: 0.72rem;
    }
}
@media (max-width: 680px) {
    .topbar {
        padding: 8px 14px !important;
    }
    .topbar-brand {
        font-size: 1.05rem;
    }
    .topbar-brand img {
        width: 24px;
        height: 24px;
    }
    .topbar-links {
        display: none;
    }
    .topbar-right a {
        padding: 8px 12px;
        font-size: 0.72rem;
    }
    .filter-bar {
        padding: 10px 12px;
        gap: 5px;
        top: 44px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    .filter-bar > * {
        flex: 0 0 auto;
    }
    .fb {
        padding: 9px 12px;
        font-size: 16px;
        min-height: 40px;
    }
    select.fb {
        font-size: 16px;
    }
    .hero {
        padding: 14px 16px;
    }
    .hero h1 {
        font-size: 1.4rem;
    }
    .hero p {
        font-size: 0.85rem;
    }
}
@media (max-width: 420px) {
    .topbar-right a {
        padding: 7px 10px;
    }
}

/* ── Amenities Panel ── */
.amen-panel {
    display: none;
    background: var(--white);
    border-bottom: 0.5px solid var(--border);
    padding: 16px 24px;
    max-height: 320px;
    overflow-y: auto;
}
.amen-panel.open {
    display: block;
}
.amen-section {
    margin-bottom: 14px;
}
.amen-section:last-child {
    margin-bottom: 0;
}
.amen-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.amen-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.amen-pill {
    padding: 7px 14px;
    border: 0.5px solid var(--border);
    border-radius: 2px;
    background: var(--bg3);
    color: var(--text);
    font-size: 0.75rem;
    font-family: var(--body);
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 400;
}
.amen-pill:hover {
    border-color: var(--text);
}
.amen-pill.on {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}
.amen-close {
    float: right;
    background: var(--text);
    border: none;
    color: var(--bg);
    font-size: 0.72rem;
    cursor: pointer;
    font-family: var(--body);
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 2px;
}

/* ── Main Layout ── */
.main {
    display: flex;
    height: calc(100vh - 52px - 140px - 44px);
}
.panel {
    width: 55%;
    overflow-y: auto;
    background: var(--bg);
}
.mapwrap {
    width: 45%;
    position: relative;
}
.mapwrap #map {
    height: 100%;
    width: 100%;
}
/* Dark map tiles handled via filter */

/* ── Listing Cards ── */
/* Cubed grid layout — multiple cards per row, photo-on-top.
       Sam: 'search page has alot of dead space maybe we have the
       listings more cubed and some empty space on the sides and the
       photos larger'. */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 16px 24px 32px;
    max-width: 1400px;
    margin: 0 auto;
}
@media (max-width: 680px) {
    .cards {
        grid-template-columns: 1fr;
        padding: 12px 14px 24px;
        gap: 12px;
    }
    .card-img,
    .card-noimg {
        height: 230px;
    }
    .card-body {
        padding: 14px 16px;
    }
    .card-price {
        font-size: 1.4rem;
    }
}
@media (max-width: 420px) {
    .card-img,
    .card-noimg {
        height: 200px;
    }
}
/* Classy box styling adopted from /tenant-search per Sam directive:
       'i like the classy look of the boxes at tenant search but thats it'.
       Photo is 4:3 aspect, save heart overlays top-right of photo, body
       padding tightened, two equal-width action buttons. */
.card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    transition:
        border-color 0.15s,
        transform 0.15s,
        box-shadow 0.15s;
    background: var(--white);
    cursor: pointer;
    position: relative;
}
.card:hover {
    border-color: var(--ed-gold);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}
.card-img,
.card-noimg {
    width: 100%;
    aspect-ratio: 4/3;
    height: auto;
    object-fit: cover;
    background: var(--bg3);
    display: block;
}
.card-photo-wrap {
    position: relative;
}
.cta-save-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
    transition: transform 0.1s;
}
.cta-save-overlay:hover {
    transform: scale(1.08);
}
.cta-save-overlay.saved {
    color: var(--ed-gold);
    background: #fff;
}
.card-noimg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.75rem;
}
.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px 14px 14px;
}
.card-price {
    font-family: var(--heading);
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text);
}
.card-price span {
    font-family: var(--body);
    font-size: 0.7rem;
    font-weight: 300;
    color: var(--muted);
}
.card-addr {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-hood {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 300;
}
.card-meta {
    display: flex;
    gap: 14px;
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 0.5px solid var(--border);
    font-weight: 300;
}
.card-meta strong {
    color: var(--text);
    font-weight: 500;
}
.card-amen {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.card-amen-tag {
    font-size: 0.6rem;
    font-weight: 400;
    padding: 2px 7px;
    border-radius: 2px;
    background: var(--bg3);
    color: var(--muted);
    border: 0.5px solid var(--border);
}
.card-tags {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    padding-top: 4px;
}
.card-inactive {
    opacity: 0.62;
    filter: saturate(0.6);
}
.card-inactive:hover {
    opacity: 0.85;
    filter: saturate(1);
}
.tag-rented {
    background: rgba(160, 136, 48, 0.15);
    color: var(--accent-solid);
    border: 0.5px solid var(--accent-solid);
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 0.62rem;
    font-weight: 500;
}
.tag-edited {
    background: rgba(0, 0, 0, 0.04);
    color: var(--muted);
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 0.62rem;
    font-weight: 400;
    margin-left: auto;
}
.tag-edited[title*='mo'] {
    color: #b45309;
} /* stale (months old) — amber */

/* Save toast — bottom-right slide-in */
#save-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #fff;
    border-left: 3px solid var(--accent-solid);
    padding: 14px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    font-size: 0.85rem;
    max-width: 320px;
    z-index: 3000;
    transform: translateY(120%);
    transition: transform 0.25s ease-out;
}
#save-toast.show {
    transform: translateY(0);
}
#save-toast b {
    font-family: var(--heading);
    font-size: 1rem;
}
#save-toast a {
    color: var(--accent-solid);
    font-weight: 500;
}
#save-toast .toast-close {
    position: absolute;
    top: 6px;
    right: 10px;
    cursor: pointer;
    color: var(--muted);
    font-size: 1rem;
    line-height: 1;
}
/* Two equal-width action buttons at the bottom of each card — tenant-search style */
.card-cta {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.cta-btn {
    flex: 1;
    font-size: 0.74rem;
    padding: 7px 8px;
    border: 0.5px solid rgba(0, 0, 0, 0.15);
    background: #fff;
    color: var(--text);
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.cta-btn:hover {
    border-color: var(--accent-solid);
    color: var(--accent-solid);
}
.cta-btn.cta-tour {
    /* default ghost */
}
.cta-btn.cta-apply {
    background: var(--accent-solid);
    color: #fff;
    border-color: var(--accent-solid);
}
.cta-btn.cta-apply:hover {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}

/* Tour-request modal */
.tour-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}
.tour-modal.open {
    display: flex;
}
.tour-modal .tm-card {
    background: #fff;
    max-width: 460px;
    width: 100%;
    padding: 28px;
    border-top: 4px solid var(--accent-solid);
    border-radius: 3px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}
.tour-modal h2 {
    font-family: var(--heading);
    font-weight: 500;
    font-size: 1.4rem;
    margin: 0 0 4px;
}
.tour-modal .tm-sub {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 16px;
}
.tour-modal label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 12px 0 4px;
    font-weight: 500;
}
.tour-modal input,
.tour-modal textarea {
    width: 100%;
    padding: 8px 10px;
    border: 0.5px solid var(--border);
    border-radius: 2px;
    font-family: inherit;
    font-size: 0.85rem;
    background: #fff;
}
.tour-modal textarea {
    resize: vertical;
    min-height: 60px;
}
.tour-modal .tm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 0.5px solid var(--border);
}
.tour-modal .tm-btn {
    padding: 9px 18px;
    border: 0.5px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 2px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.82rem;
}
.tour-modal .tm-btn.primary {
    background: var(--accent-solid);
    color: #fff;
    border-color: var(--accent-solid);
    font-weight: 500;
}
.tour-modal .tm-status {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 10px;
    min-height: 18px;
}
.tag {
    font-size: 0.58rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tag-nofee {
    background: rgba(34, 197, 94, 0.08);
    color: var(--green);
}
.tag-avail {
    background: rgba(59, 130, 246, 0.06);
    color: var(--blue);
}

/* ── Map Pins ── */
.pin {
    background: var(--text);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 4px;
    white-space: nowrap;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    font-family: var(--body);
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
    min-width: 60px;
    text-align: center;
}
.pin:hover {
    background: var(--gold-solid);
    color: #fff;
    transform: scale(1.12);
    z-index: 999 !important;
}
.pin.hl {
    background: var(--gold-solid);
    color: #fff;
    transform: scale(1.12);
    z-index: 999 !important;
}
/* Remove dark map invert — use light tiles with cream brand */
.leaflet-tile-pane {
    filter: saturate(0.4) brightness(1.02);
}

/* ── Listing Detail Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    overflow-y: auto;
    padding: 24px;
}
.modal-overlay.open {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.modal {
    background: var(--white);
    border-radius: 2px;
    max-width: 800px;
    width: 100%;
    margin-top: 40px;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: var(--text);
    color: var(--bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 1.1rem;
    z-index: 10;
}
.modal-photos {
    display: flex;
    overflow-x: auto;
    gap: 2px;
    background: var(--bg3);
    scroll-snap-type: x mandatory;
}
.modal-photos img {
    height: 320px;
    object-fit: cover;
    flex-shrink: 0;
    scroll-snap-align: start;
}
.modal-body {
    padding: 28px;
}
.modal-price {
    font-family: var(--heading);
    font-size: 2rem;
    font-weight: 500;
}
.modal-price span {
    font-family: var(--body);
    font-size: 0.82rem;
    font-weight: 300;
    color: var(--muted);
}
.modal-addr {
    font-size: 1rem;
    font-weight: 400;
    margin-top: 4px;
}
.modal-hood {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 300;
    margin-top: 2px;
}
.modal-meta {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    padding: 14px 0;
    border-top: 0.5px solid var(--border);
    border-bottom: 0.5px solid var(--border);
    font-size: 0.85rem;
    color: var(--muted);
}
.modal-meta strong {
    color: var(--text);
    font-weight: 500;
    display: block;
    font-size: 1.1rem;
}
.modal-section {
    margin-top: 20px;
}
.modal-section h3 {
    font-family: var(--heading);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 10px;
}
.modal-desc {
    font-size: 0.85rem;
    line-height: 1.7;
    color: #555;
    font-weight: 300;
}
.modal-amen-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.modal-amen-pill {
    padding: 6px 12px;
    border: 0.5px solid var(--border);
    border-radius: 2px;
    font-size: 0.78rem;
    background: var(--bg3);
}
.modal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 0.82rem;
}
.modal-details dt {
    color: var(--muted);
    font-weight: 300;
}
.modal-details dd {
    color: var(--text);
    font-weight: 400;
    margin: 0;
}
.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}
/* Header row: price/addr on the left, Apply/Tour CTAs on the right.
       Sam: 'move the apply now sceduel tour to the top on the other side'. */
.modal-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 8px;
}
.modal-header-left {
    flex: 1;
    min-width: 0;
}
.modal-header-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}
.modal-header-actions .modal-btn {
    white-space: nowrap;
    padding: 9px 16px;
    font-size: 0.78rem;
}
@media (max-width: 640px) {
    .modal-header-row {
        flex-direction: column;
    }
    .modal-header-actions {
        flex-direction: row;
        width: 100%;
    }
    .modal-header-actions .modal-btn {
        flex: 1;
    }
}
.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 2px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
}
.modal-btn-primary {
    background: var(--text);
    color: var(--bg);
}
.modal-btn-outline {
    background: none;
    border: 0.5px solid var(--border);
    color: var(--text);
}
@media (max-width: 900px) {
    .modal-photos img {
        height: 220px;
    }
    .modal-body {
        padding: 16px;
    }
}

/* ── Loading ── */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 300;
}
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 8px;
}

/* ── Infinite scroll: status footer ── */
/* Shows a gold "loading more" spinner while the next page is fetched, and a
   quiet end-of-results marker once everything is loaded. */
.list-foot {
    min-height: 24px;
    padding: 4px 24px 40px;
    text-align: center;
    color: var(--muted);
}
.list-foot .spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    border-top-color: var(--ed-gold);
    margin: 10px auto 0;
}
.list-foot .list-end {
    display: inline-block;
    margin-top: 12px;
    font-family: var(--heading);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    opacity: 0.7;
}
.list-foot .list-end::before,
.list-foot .list-end::after {
    content: '';
    display: inline-block;
    width: 28px;
    height: 1px;
    margin: 0 10px;
    vertical-align: middle;
    background: var(--gold-solid);
    opacity: 0.5;
}
.list-foot .fb {
    margin-top: 10px;
}
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation-duration: 1.6s;
    }
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .main {
        flex-direction: column;
        height: auto;
    }
    .panel {
        width: 100%;
    }
    .mapwrap {
        width: 100%;
        height: 250px;
        order: -1; /* map sits above the listings on the stacked layout */
    }
    /* Amenities = a sheet layered above the filter sheet (which is z-index 500). */
    .amen-panel {
        position: fixed;
        inset: 0;
        z-index: 600;
        max-height: none;
        padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    }
    .cards {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        padding: 12px 16px 24px;
        gap: 12px;
    }
    .card-img,
    .card-noimg {
        height: 170px;
    }
    .hero h1 {
        font-size: 1.6rem;
    }
    .hero {
        padding: 32px 16px 24px;
    }
    .topbar-links {
        display: none;
    }
}

/* ── Externalized one-off styling (was inline style= attrs) ───────────── */
.topbar-brand .seal {
    display: inline-block;
    width: 30px;
    height: 30px;
    background-color: #a08830;
    -webkit-mask: url(/img/brand/MySpaceNYC-Logo-forest-512px.png) center / contain no-repeat;
    mask: url(/img/brand/MySpaceNYC-Logo-forest-512px.png) center / contain no-repeat;
    -webkit-mask-mode: alpha;
    mask-mode: alpha;
    flex: 0 0 auto;
}
#tab-active {
    opacity: 0.65;
}
.fb-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
}
.fb-count .spinner {
    width: 12px;
    height: 12px;
    border-width: 2px;
}
.cmp-count {
    font-size: 0.78rem;
    flex: 0 0 auto;
}
#compare-tray .open-btn:disabled {
    opacity: 0.55;
}
.compare-clear {
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 8px;
}

/* ── Accessibility ── */
/* Visually-hidden content that stays available to screen readers. */
.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 — hidden until focused, then pinned top-left on brand gold. */
.skip-link {
    position: absolute;
    left: 8px;
    top: -48px;
    z-index: 400;
    padding: 10px 16px;
    background: var(--gold-solid);
    color: #fff;
    font-family: var(--body);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 2px;
    text-decoration: none;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 8px;
}
/* Clear, on-brand keyboard focus ring across the interactive surface. Mouse
   users don't see it (:focus-visible); keyboard users always do. */
.card:focus-visible,
.fb:focus-visible,
.amen-pill:focus-visible,
.search-input:focus-visible,
.fb-reset:focus-visible,
.modal-close:focus-visible,
.cta-btn:focus-visible,
.cta-save-overlay:focus-visible,
.cta-compare-overlay:focus-visible,
.tm-btn:focus-visible,
#compare-tray button:focus-visible,
.amen-close:focus-visible {
    outline: 2px solid var(--gold-solid);
    outline-offset: 2px;
}
.card:focus-visible {
    border-color: var(--ed-gold);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06);
}
