/* Unified Listings Workspace -- List/Map over the live-certified MLS Search
   endpoint. Uses the shared design tokens defined in base.css
   (--space-*, --radius-*, --bg-*, --text-*, --accent-*, --border-soft,
   --shadow-card, --focus-ring). See frontend/js/pages/listings.js for the
   controller this styles. */

.listings-workspace {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

/* ── Toolbar ─────────────────────────────────────────────────────────── */

.listings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.listings-view-toggle {
    display: inline-flex;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    padding: 4px;
    gap: 2px;
}

.listings-view-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.listings-view-btn:hover {
    color: var(--text-primary);
}

.listings-view-btn.active {
    background: var(--accent-primary);
    color: #fff;
}

.listings-view-btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ── Filters ─────────────────────────────────────────────────────────── */

.listings-filters {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

/* ── Unified search bar (2026-09-04 "Listings Search UX" ticket) ───────
   One prominent input above the structured filter row. Deterministic
   classification only (see classifyListingsUnifiedSearchInput() in
   listings.js) -- never fuzzy/AI text interpretation. */

.listings-unified-search-row {
    display: flex;
}

.listings-unified-search-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.listings-unified-search-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.listings-unified-search-field input {
    font: inherit;
    font-size: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
    min-height: 44px;
}

.listings-unified-search-field input:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.listings-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
}

.listings-filter-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 160px;
    min-width: 120px;
}

.listings-filter-field--narrow {
    flex: 0 1 110px;
    min-width: 90px;
}

.listings-filter-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.listings-filter-field input,
.listings-filter-field select {
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
}

.listings-filter-field input:focus-visible,
.listings-filter-field select:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

/* ── Custom quick-filter dropdown (2026-09-11 "map covers select dropdown"
   fix) ────────────────────────────────────────────────────────────────
   Property Type / Status / Sort By / Direction sit directly above the
   Leaflet map. On some Windows/Chromium GPU setups, Leaflet's hardware-
   accelerated tile layer paints above native <select> popups (a browser-
   owned overlay outside our page's z-index stack, so no z-index on the
   map or the select can fix it -- Leaflet's own panes already top out at
   700, see the Search This Area button's own comment above). The real
   <select> stays in the DOM as the single source of truth (same
   "hidden native input drives a custom UI" pattern as the sched-dtp
   date/time pickers) -- initListingsCustomSelect() in listings.js hides
   it with .sched-dtp-native-hidden and layers this DOM-rendered trigger
   + panel in front, which we fully control and can guarantee paints
   above the map. */
.listings-custom-select {
    position: relative;
}

.listings-custom-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font: inherit;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.listings-custom-select-trigger:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.listings-custom-select-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listings-custom-select-chevron {
    flex-shrink: 0;
    opacity: 0.6;
}

.listings-custom-select-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1000;
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-2);
    display: grid;
    gap: 2px;
}

.listings-custom-select-panel.hidden {
    display: none;
}

.listings-custom-select-option {
    display: block;
    width: 100%;
    font: inherit;
    text-align: left;
    min-height: 32px;
    padding: 5px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
}

.listings-custom-select-option:hover,
.listings-custom-select-option:focus-visible {
    background: var(--bg-main);
}

.listings-custom-select-option.active {
    background: var(--accent-primary);
    color: var(--accent-on-primary, #fff);
}

.listings-filter-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: auto;
}

/* ── Status bar / states ─────────────────────────────────────────────── */

.listings-advanced-trigger.active {
    border-color: var(--accent-primary);
    color: var(--accent-strong, var(--accent-primary));
}

/* Step 9 -- compact, removable applied-filter chip row on the main
   workspace (outside the All Filters modal). Sits directly under the
   filter bar; hidden entirely (via the .hidden class JS toggles) when no
   advanced filter is applied, so it never reserves dead space. */
.listings-applied-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.listings-applied-chips.hidden {
    display: none;
}

.listings-applied-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 4px 6px 4px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
}

.listings-applied-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listings-applied-chip button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 999px;
}

.listings-applied-chip button:hover,
.listings-applied-chip button:focus-visible {
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
}

.listings-applied-chip-more,
.listings-applied-chip-clear-all {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 6px;
}

.listings-applied-chip-more:hover,
.listings-applied-chip-clear-all:hover,
.listings-applied-chip-more:focus-visible,
.listings-applied-chip-clear-all:focus-visible {
    color: var(--accent-strong, var(--accent-primary));
    outline: none;
    text-decoration: underline;
}

.listings-advanced-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal, 6000) + 10);
    background: rgba(0, 0, 0, 0.4);
}

.listings-advanced-backdrop.hidden {
    display: none;
}

/* All Filters -- large, near-fullscreen centered workspace on desktop/
   tablet (Step 5); a right-slide drawer was the right shape for ~10 quick
   filters, not a categorized catalog covering the full certified MLS
   surface. Mobile (<=768px, below) goes fully full-screen instead. */
.listings-advanced-drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.98);
    z-index: calc(var(--z-modal, 6000) + 20);
    width: min(1080px, calc(100vw - 48px));
    height: min(860px, calc(100dvh - 48px));
    display: flex;
    flex-direction: column;
    /* Bounds the modal to its own fixed height -- without this, the two
       internally-scrolling panes below (.listings-advanced-category-nav /
       .listings-advanced-body) can still push the drawer's OWN box taller
       than its declared height, spilling section content out past the
       visible card and stranding the footer mid-page instead of pinned to
       the actual bottom edge. */
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.32);
    opacity: 1;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.listings-advanced-drawer.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.98);
    visibility: hidden;
    pointer-events: none;
}

.listings-advanced-main {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

.listings-advanced-category-nav {
    flex: 0 0 auto;
    width: 176px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) var(--space-2);
    overflow-y: auto;
    border-right: 1px solid var(--border-soft);
    background: var(--bg-main);
}

.listings-advanced-category-nav button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    padding: 8px 10px;
    border-radius: var(--radius-md);
}

.listings-advanced-category-nav button:hover,
.listings-advanced-category-nav button:focus-visible {
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
}

.listings-advanced-category-nav button.active {
    background: var(--bg-card);
    color: var(--accent-strong, var(--accent-primary));
}

.listings-advanced-header {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.listings-advanced-header h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
    color: var(--text-primary);
}

.listings-advanced-header p {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.listings-advanced-close {
    appearance: none;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.listings-advanced-close:hover,
.listings-advanced-close:focus-visible {
    background: var(--bg-main);
    color: var(--text-primary);
    outline: none;
}

.listings-advanced-summary {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.listings-advanced-summary span {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    max-width: 100%;
    padding: 3px 9px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.listings-advanced-search {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.listings-advanced-search label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.listings-advanced-pinned {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-main);
}

.listings-advanced-pinned.hidden {
    display: none;
}

.listings-advanced-pinned-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
}

.listings-advanced-pinned-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.listings-advanced-pinned-chip,
.listings-advanced-pin-btn {
    appearance: none;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

.listings-advanced-pinned-chip {
    max-width: 100%;
    min-height: 28px;
    padding: 4px 9px;
    border-radius: var(--radius-full);
}

.listings-advanced-filter-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.listings-advanced-pin-btn {
    flex: 0 0 auto;
    min-height: 26px;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
}

.listings-advanced-pin-btn.active,
.listings-advanced-pin-btn:hover,
.listings-advanced-pinned-chip:hover,
.listings-advanced-pin-btn:focus-visible,
.listings-advanced-pinned-chip:focus-visible {
    border-color: var(--accent-primary);
    color: var(--accent-strong, var(--accent-primary));
    outline: none;
}

.listings-advanced-body {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-3) var(--space-4) var(--space-4);
}

.listings-advanced-section {
    border-bottom: 1px solid var(--border-soft);
    padding: var(--space-2) 0;
}

.listings-advanced-section summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
}

.listings-advanced-section summary::-webkit-details-marker {
    display: none;
}

.listings-advanced-section summary::after {
    content: '+';
    color: var(--text-muted);
    font-weight: 800;
}

.listings-advanced-section[open] summary::after {
    content: '-';
}

.listings-advanced-section--search-hidden {
    display: none;
}

.listings-advanced-section summary:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Step 13 "Clear section" -- injected into each category's <summary> by
   ensureListingsAdvancedCategoryClearButtons(). Sits before the +/- open
   indicator (CSS-generated content always renders last within the flex
   row, after this real child). */
.listings-advanced-category-clear-btn {
    appearance: none;
    border: 1px solid var(--border-soft);
    background: var(--bg-main);
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    margin-left: auto;
}

.listings-advanced-category-clear-btn:hover,
.listings-advanced-category-clear-btn:focus-visible {
    border-color: var(--accent-primary);
    color: var(--accent-strong, var(--accent-primary));
    outline: none;
}

.listings-advanced-section-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    align-items: start;
    gap: var(--space-3);
    padding: var(--space-2) 0 var(--space-3);
}

.listings-advanced-range,
.listings-advanced-minonly,
.listings-advanced-text,
.listings-advanced-toggle-group,
.listings-advanced-collection {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.listings-advanced-range > label,
.listings-advanced-text label,
.listings-advanced-minonly label,
.listings-advanced-toggle-group label,
.listings-advanced-collection-label,
.listings-advanced-filter-head label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.listings-advanced-filter-control.hidden {
    display: none;
}

.listings-advanced-residential-refinement-hint {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.listings-advanced-residential-refinement-hint[hidden] {
    display: none;
}

.listings-advanced-minmax {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--space-2);
}

.listings-advanced-drawer input,
.listings-advanced-drawer select {
    width: 100%;
    min-width: 0;
    font: inherit;
    padding: 9px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
}

.listings-advanced-drawer input:focus-visible,
.listings-advanced-drawer select:focus-visible {
    border-color: var(--accent-primary);
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.listings-advanced-collection-trigger {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.listings-advanced-collection-trigger:disabled {
    cursor: default;
    color: var(--text-muted);
}

.listings-advanced-collection-trigger:focus-visible,
.listings-advanced-collection-clear:focus-visible,
.listings-advanced-collection-option input:focus-visible {
    border-color: var(--accent-primary);
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.listings-advanced-collection-summary {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.listings-advanced-collection-count {
    flex: 0 0 auto;
    min-width: 22px;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    background: var(--accent-soft-bg, rgba(180, 138, 99, 0.14));
    color: var(--accent-strong, var(--accent-primary));
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.listings-advanced-collection-panel {
    display: none;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    padding: var(--space-2);
    box-shadow: var(--shadow-card);
}

.listings-advanced-collection.open .listings-advanced-collection-panel {
    display: block;
}

.listings-advanced-collection-options {
    max-height: 190px;
    overflow-y: auto;
    display: grid;
    gap: 2px;
    margin-top: var(--space-2);
    padding-right: 2px;
}

.listings-advanced-collection-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 5px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 13px;
}

.listings-advanced-collection-option:hover {
    background: var(--bg-main);
}

.listings-advanced-collection-option input {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    min-width: 16px;
}

/* Schools combobox (Wave A) -- single-select radio list reusing the
   collection-option row shape; .selected marks the currently-committed
   option so it stays visually distinct even after the search box filters
   it out of view and back in. */
.listings-advanced-scalar-option.selected {
    background: var(--bg-main);
    color: var(--accent-strong, var(--accent-primary));
    font-weight: 700;
}

.listings-advanced-collection-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: var(--space-2);
}

.listings-advanced-collection-chip {
    max-width: 100%;
    padding: 3px 8px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.listings-advanced-collection-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.listings-advanced-collection-clear {
    appearance: none;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    padding: 5px 8px;
}

.listings-advanced-collection-status {
    color: var(--text-muted);
    font-size: 12px;
}

.listings-advanced-footer {
    /* No longer position:sticky (that was correct for the old design,
       where the footer sat at the end of a single scrolling column and
       needed to stick to its own scroll container's bottom edge). Now
       that .listings-advanced-drawer is a fixed-height, non-scrolling box
       with its OWN overflow:hidden and two independently-scrolling panes
       inside .listings-advanced-main, a plain flex:0 0 auto sibling
       already lands at the true bottom of the column -- sticky had no
       correctly-scoped scroll container to attach to anymore and could
       resolve against the page/viewport instead, stranding it mid-modal. */
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--border-soft);
    background: var(--bg-card);
}

.listings-advanced-footer .btn {
    flex: 1 1 0;
}

.listings-status-bar:empty {
    display: none;
}

.listings-initial-state,
.listings-loading-state,
.listings-empty-state,
.listings-error-state {
    padding: var(--space-6);
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
}

.listings-error-state {
    color: #B3261E;
}

/* "MLS LISTINGS ADDRESS SEARCH FINALIZATION" ticket (2026-09-07) -- compact
   "Did you mean?" banner shown above the suggested candidates (rendered as
   normal listing cards) when the address fallback outcome is 'suggestions'.
   Deliberately not styled as an error/empty state -- it precedes real,
   selectable results. */
.listings-address-suggestions-banner {
    padding: var(--space-3) var(--space-4);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-strong, var(--accent-primary));
    background: var(--accent-soft-bg, rgba(180, 138, 99, 0.14));
    border: 1px solid var(--accent-soft-border, var(--accent-primary));
    border-radius: var(--radius-md, 8px);
    margin-bottom: var(--space-3);
}

/* ── Results / List ──────────────────────────────────────────────────── */

.listings-results {
    position: relative;
}

.listings-list-view,
.listings-map-view {
    display: none;
}

.listings-list-view.active {
    display: block;
}

/* .listings-map-view.active's display is set below (grid, for the
   upside-down-L map+side-panel layout) -- kept as a single rule rather
   than split across two selectors that would otherwise rely on source
   order to resolve which "display" wins. */

.listings-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

.listings-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow-card);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.listings-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}

.listings-card:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.listings-card-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    background: linear-gradient(135deg, var(--bg-main), var(--bg-card));
    color: var(--text-muted);
}

.listings-card-photo-placeholder--skeleton {
    background: var(--bg-main);
    animation: listings-skeleton-pulse 1.3s ease-in-out infinite;
}

/* Real, policy-approved photo variant -- same box, same footprint, so
   swapping between placeholder and real photo (or falling back on load
   failure) never shifts surrounding layout. */
.listings-card-photo-placeholder--photo {
    background: none;
    padding: 0;
}

.listings-card-photo-placeholder--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listings-card-attribution {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.listings-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-3) var(--space-4) var(--space-4);
}

.listings-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.listings-card-address {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.listings-card-city {
    font-size: 13px;
    color: var(--text-muted);
}

.listings-card-mls,
.listings-map-card-mls,
.listings-detail-mls {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    color: var(--text-muted);
}

.listings-card-mls,
.listings-map-card-mls {
    font-size: 12px;
}

.listings-card-mls strong,
.listings-map-card-mls strong,
.listings-detail-mls strong {
    color: var(--text-primary);
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
}

.listings-card-facts {
    display: flex;
    gap: var(--space-3);
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.listings-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 12px;
}

.listings-card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin-top: var(--space-3);
}

.listings-add-client-btn {
    min-height: 32px;
}

/* List-view Compare (2026-09-09 "Staging QA Regression Fix" ticket) --
   comparing was previously only possible from the Map view; this mirrors
   .listings-map-compare-btn's active/hover treatment so List and Map
   compare toggles read as the same control. */
.listings-card-compare-btn {
    min-height: 32px;
}

.listings-card-compare-btn.active {
    background: var(--accent-soft-bg);
    border-color: var(--accent-soft-border);
    color: var(--accent-strong, var(--accent-primary));
}

.listings-list-compare-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

/* ── Status pill (2026-09-05 "Listings Next" ticket; recolored
   2026-09-09 "Staging QA Regression Fix" ticket) ──────────────────────
   ONE centralized color mapping (getListingsStatusPillClass() in
   listings.js), reused by every surface -- List card, Map card, Detail
   badge, Compare. The status TEXT itself (e.g. "Active", "Pending",
   "Closed") is always the real, screen-reader-visible signal -- color is
   reinforcement, never the only way the status is conveyed.

   Deliberately NOT the shared --success-bg/--warning-bg design tokens:
   those resolve to pale, near-white pastel backgrounds in every theme in
   this codebase (base.css), including the dark theme, which is exactly
   Diego's live QA complaint ("white-ish... in the dark theme"). Rather
   than changing those shared tokens -- used well beyond Listings, and out
   of scope for an MLS-page-only fix -- these are solid, saturated,
   Listings-scoped colors with light text, fixed across both themes per
   Diego's explicit ask ("darker with light font" in EITHER theme, not
   theme-adaptive pastel). */
.listings-status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.listings-status-pill--positive {
    background: #15803d;
    color: #ffffff;
    border-color: #15803d;
}

.listings-status-pill--pending {
    background: #b45309;
    color: #ffffff;
    border-color: #b45309;
}

.listings-status-pill--neutral {
    background: #475569;
    color: #ffffff;
    border-color: #475569;
}

.listings-card-status {
    /* Sizing/positioning only -- color/contrast comes from
       .listings-status-pill and its --positive/--pending/--neutral
       modifier above. */
}

.listings-card-dom {
    color: var(--text-muted);
}

.listings-skeleton-line {
    height: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-main);
    animation: listings-skeleton-pulse 1.3s ease-in-out infinite;
}

.listings-skeleton-line--wide {
    width: 70%;
    height: 16px;
}

.listings-skeleton-line--short {
    width: 45%;
}

@keyframes listings-skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

/* ── Pagination ──────────────────────────────────────────────────────── */

.listings-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-5);
}

.listings-pagination-label {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 60px;
    text-align: center;
}

/* Compact numbered window (2026-09-05 "Listings Next" ticket) -- First/
   Previous/[numbers]/Next/Last. Last stays hidden until totalPages is an
   honestly-known number (see renderListingsPagination()'s own comment --
   live Search's total is unknown until the true last page is reached, so
   this control never fabricates a page count). */
.listings-pagination-numbers {
    display: flex;
    align-items: center;
    gap: 2px;
}

.listings-pagination-number {
    font: inherit;
    font-size: 13px;
    min-width: 36px;
    min-height: 36px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

.listings-pagination-number:hover {
    background: var(--control-bg-hover);
}

.listings-pagination-number.active {
    background: var(--accent-primary);
    color: #ffffff;
    font-weight: 600;
    cursor: default;
}

.listings-pagination-number:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.listings-pagination-ellipsis {
    padding: 0 4px;
    color: var(--text-muted);
    font-size: 13px;
    user-select: none;
}

@media (max-width: 640px) {
    .listings-pagination {
        gap: var(--space-1, 4px);
    }
    /* On narrow viewports, keep First/Last as icon-free text but let the
       numbered window collapse to just the active page + immediate
       neighbors -- computeListingsPaginationWindow() already bounds this
       to at most 5 numbers server-agnostically; this media query only
       trims visual padding/gaps, never hides a control outright, so
       keyboard/screen-reader users never lose functionality on mobile. */
    .listings-pagination-number {
        min-width: 32px;
        padding: 0 4px;
    }
}

/* ── Map ─────────────────────────────────────────────────────────────── */
/* Desktop: upside-down-L -- map left, "Available Properties" side panel
   right, both fed from the SAME ListingsState.results already in memory
   (no second fetch, no second property array). See listings.js's
   renderListingsMapSidePanel() / renderListingsMapMarkers(). */

.listings-map-view.active {
    display: grid;
    /* minmax(340px, 1fr) on the panel: at typical desktop widths this is
       identical to a plain 1fr, but it stops the panel column from ever
       being squeezed below a usable width for a price/address card. */
    grid-template-columns: minmax(0, 2fr) minmax(340px, 1fr);
    gap: var(--space-4);
    align-items: start;
}

/* UPDATED 2026-09-09 "Staging QA Regression Fix" ticket: replaced a static
   calc(100dvh - 320px) offset guess with a runtime measurement of
   #listingsMapView's real getBoundingClientRect().top
   (updateListingsMapWorkspaceHeight, listings.js) written into
   --listings-map-workspace-height. CORRECTED 2026-09-10 "Final Listings
   Staging UI Correction" ticket: that runtime measurement was originally
   used as a hard MAXIMUM ("whatever viewport space remains below the
   filters"), which made the real product UX worse -- this app's filter
   chrome is tall enough that remaining space is often near-minimal on an
   ordinary desktop screen, so the workspace visibly shrank (Diego's live
   QA: fewer than 3 cards, down from ~5 before any of this height work).
   The page is allowed to scroll -- see computeListingsMapWorkspaceHeight's
   own comment in listings.js for the corrected model: a generous,
   width-tiered MINIMUM that the viewport figure can only ever grow beyond
   on a tall screen, never shrink below. The calc() here is only a
   same-math fallback for the very first paint before that JS runs (or a
   non-DOM test harness) -- never the primary source of truth. */
/* Wraps the Leaflet container so the Search This Area button (2026-09-10
   "COORDY — MAP BOUNDS CERTIFIED LIVE" ticket) can float over the map as a
   sibling, positioned absolutely against THIS wrapper -- never as a child
   of #listingsMapContainer itself, which Leaflet owns and could otherwise
   disturb. The wrapper carries the actual sized height; the map container
   is simply 100% of it. */
.listings-map-container-wrap {
    position: relative;
    height: var(--listings-map-workspace-height, max(740px, calc(100dvh - 320px)));
}

.listings-map-container {
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-soft);
}

/* ── Available Properties side panel ────────────────────────────────── */

.listings-map-side-panel {
    display: flex;
    flex-direction: column;
    height: var(--listings-map-workspace-height, max(740px, calc(100dvh - 320px)));
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* ── Client Search (Map side panel) ─────────────────────────────────── */
/* Sits above .listings-map-panel-header/-cards, outside the scrolling
   region -- always visible while the card list below it scrolls. Real
   scoped CRM clients only (shares Add to Client's client cache); zero MLS
   requests anywhere in this block. See listings.js's Client Search
   section for the fail-closed preference->filter mapping rules. */

.listings-client-search {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.listings-client-search-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.listings-client-search-input-wrap {
    position: relative;
}

.listings-client-search-input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-main);
    color: var(--text-primary);
}

.listings-client-search-input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 1px;
}

.listings-client-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 4;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 4px;
}

.listings-client-result {
    display: block;
    width: 100%;
    text-align: left;
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 13px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.listings-client-result:hover,
.listings-client-result:focus-visible {
    background: var(--accent-soft-bg);
    outline: none;
}

.listings-client-search-empty {
    padding: 8px 10px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.listings-client-selected {
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--bg-main);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
}

.listings-client-selected-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.listings-client-selected-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Collapsible panel (2026-09-05 "Listings Next" ticket) -- summary text is
   the "<Client Name> · X preferences applied" compact readout. Only shown
   while collapsed -- when expanded, the full chip detail below already
   conveys this, so showing both would be redundant. */
.listings-client-selected-summary {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: none;
}

.listings-client-selected.collapsed .listings-client-selected-summary {
    display: block;
}

.listings-client-collapse-btn {
    appearance: none;
    flex-shrink: 0;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    min-height: 28px;
}

.listings-client-collapse-btn:hover {
    border-color: var(--accent-primary);
}

.listings-client-collapse-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.listings-client-clear-btn {
    appearance: none;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
}

.listings-client-clear-btn:hover,
.listings-client-clear-btn:focus-visible {
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
}

.listings-client-chips {
    margin-top: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.listings-client-loaded-note {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-strong, var(--accent-primary));
}

.listings-client-chip-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.listings-client-chip-label {
    flex-basis: 100%;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.listings-client-chip {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
}

.listings-client-chip--applied {
    background: var(--accent-soft-bg);
    border-color: var(--accent-soft-border);
    color: var(--accent-strong, var(--accent-primary));
    font-weight: 600;
}

/* "Not yet searchable" chips are real <button> elements -- clicking one
   sets the client-side quick filter (see setListingsQuickFilterText). They
   have no verified MLS filter mapping, so this is the only thing a click
   can safely do with them. */
.listings-client-chip--clickable {
    appearance: none;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.listings-client-chip--clickable:hover,
.listings-client-chip--clickable:focus-visible {
    background: var(--bg-main);
    border-color: var(--accent-soft-border);
    color: var(--text-primary);
    outline: none;
}

.listings-client-budget {
    font-size: 12px;
    color: var(--text-muted);
}

.listings-client-chip-empty {
    font-size: 12px;
    color: var(--text-muted);
}

.listings-map-panel-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-soft);
}

.listings-map-panel-header-actions {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
}

.listings-compare-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.listings-compare-clear-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 2px;
}

.listings-compare-clear-btn:hover,
.listings-compare-clear-btn:focus-visible {
    color: var(--text-primary);
    text-decoration: underline;
    outline: none;
}

.listings-map-panel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.listings-map-panel-count {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.listings-map-panel-cards {
    /* Scrolls its own content when the card stack exceeds the panel's
       height -- relies on .listings-map-card opting out of flex-shrink
       (see its own comment) rather than letting cards compress instead.
       min-height: 0 is required (2026-09-05 "Listings Next" ticket) for
       overflow-y: auto to actually activate inside a flex column -- without
       it, a flex item sizes to its own content instead of the space
       actually available, so the taller side panel above would just grow
       to fit every card instead of scrolling (same class of fix already
       documented on .listings-detail-drawer-body). Gap tightened from
       --space-2 to 6px (Phase 18 card-density pass) -- text sizes are
       deliberately UNTOUCHED (never shrunk below readable) -- the modest
       inter-card spacing reduction is what lets a few more cards fit
       without harming legibility. */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.listings-map-panel-message {
    padding: var(--space-3);
    font-size: 13px;
    color: var(--text-muted);
}

.listings-map-panel-message-clear {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--accent-primary);
    font: inherit;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

/* ── Search This Area (2026-09-10 "COORDY — MAP BOUNDS CERTIFIED LIVE"
   ticket) ─────────────────────────────────────────────────────────────
   Floats top-CENTER over the map, deliberately clear of Leaflet's default
   zoom control (top-left) and any marker/popup that opens near the top of
   the viewport. z-index 1000 sits above every Leaflet pane (tile/overlay/
   shadow/marker/tooltip/popup all top out at 700) so nothing can render
   over it. Uses the shared .hidden utility (idx.css, display:none
   !important) for its hidden state -- see listings.js's own comment on
   why that utility (not the native hidden property) is required here. */
.listings-search-this-area-btn {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    padding: 0 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    box-shadow: var(--shadow-card);
}

.listings-search-this-area-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-strong, var(--accent-primary));
}

.listings-search-this-area-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.listings-search-this-area-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ── Load More (map-bounds accumulated results) ─────────────────────── */

.listings-map-load-more-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) 0 var(--space-2);
    text-align: center;
}

.listings-map-load-more-btn {
    min-height: 44px;
    padding: 0 20px;
}

.listings-map-load-more-error {
    font-size: 12.5px;
    color: var(--danger-text, #b91c1c);
}

.listings-map-end-of-results {
    font-size: 12.5px;
    color: var(--text-muted);
}

/* ── Quick filter (client-side only -- see ListingsState.quickFilterText) ── */

.listings-quick-filter {
    position: relative;
    padding: 0 var(--space-3);
    margin-top: var(--space-2);
}

.listings-quick-filter-input {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 13px;
    padding: 7px 30px 7px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    background: var(--bg-main);
    color: var(--text-primary);
}

.listings-quick-filter-input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 1px;
}

.listings-quick-filter-clear {
    position: absolute;
    right: calc(var(--space-3) + 6px);
    top: 50%;
    transform: translateY(-50%);
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: var(--radius-sm);
}

.listings-quick-filter-clear:hover,
.listings-quick-filter-clear:focus-visible {
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
}

/* ── Compact Map card ───────────────────────────────────────────────── */

.listings-map-card {
    position: relative;
    background: var(--bg-main);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    cursor: pointer;
    overflow: hidden;
    /* Root cause of the compressed-card bug: this card sets overflow:hidden
       (to keep the absolutely-positioned hover ribbon inside the rounded
       corners), and per the flexbox spec a flex item's automatic minimum
       size resolves to 0 whenever overflow isn't visible. Inside the
       scrolling flex column below, that let every card shrink toward zero
       height to force ~25 of them into one fixed-height panel instead of
       the panel actually scrolling. flex-shrink: 0 opts this item out of
       shrinking entirely, so its natural content height wins and the
       parent's overflow-y: auto does its job. min-height keeps a
       consistent, readable row height even for sparse content.
       See .listings-map-panel-cards. */
    flex-shrink: 0;
    min-height: 96px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.listings-map-card:hover,
.listings-map-card:focus-visible,
.listings-map-card.highlighted {
    border-color: var(--accent-primary);
}

.listings-map-card:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.listings-map-card.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--accent-primary) inset;
    /* Selected state must read beyond color alone -- see the check badge
       in buildListingsMapCardHtml(). */
}

/* Deliberate placeholder visual anchor -- NEVER a real photo (Media display
   isn't authorized). Bleeds off the card's right edge and fades toward the
   left via a mask, so it reads as an ambient image without pretending to
   be one. Purely decorative -- aria-hidden, pointer-events none, and
   z-index'd below the text so it never affects legibility or hit-testing. */
.listings-map-card-photo-fade {
    position: absolute;
    inset: 0;
    left: auto;
    width: 55%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: var(--space-2);
    background: linear-gradient(135deg, var(--accent-soft-bg), var(--bg-main) 75%);
    -webkit-mask-image: linear-gradient(to left, black 30%, transparent 95%);
    mask-image: linear-gradient(to left, black 30%, transparent 95%);
    color: var(--accent-primary);
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

/* Real, policy-approved photo variant -- same absolutely-positioned,
   masked-fade box as the decorative placeholder above (so the compact row's
   layout never changes shape), but at full opacity with an actual photo
   instead of the muted icon+gradient. */
.listings-map-card-photo-fade--image {
    background: none;
    opacity: 1;
}

.listings-map-card-photo-fade--image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.listings-map-card-body {
    position: relative;
    z-index: 1;
    max-width: 65%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.listings-map-card-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.listings-map-card-address {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listings-map-card-mls {
    white-space: nowrap;
}

/* Always-visible quick facts (beds/baths/status) -- distinct from the
   hover/focus ribbon below, which adds property type and days-on-market
   on top of these same fields without requiring a hover to see anything
   at all. */
.listings-map-card-facts {
    display: flex;
    gap: var(--space-2);
    font-size: 11px;
    color: var(--text-muted);
}

.listings-map-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.listings-map-add-client-btn,
.listings-map-compare-btn {
    appearance: none;
    border: 1px solid var(--border-soft);
    background: var(--bg-card);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.listings-map-add-client-btn:hover,
.listings-map-add-client-btn:focus-visible,
.listings-map-compare-btn:hover,
.listings-map-compare-btn:focus-visible {
    border-color: var(--accent-primary);
    color: var(--accent-strong, var(--accent-primary));
    outline: none;
}

.listings-map-compare-btn.active {
    background: var(--accent-soft-bg);
    border-color: var(--accent-soft-border);
    color: var(--accent-strong, var(--accent-primary));
}

/* Status pill + selected checkmark share this one top-right corner slot
   (2026-09-09 "Staging QA Regression Fix" ticket) -- a flex row rather than
   two independently absolutely-positioned elements, so a status pill's
   variable text width never overlaps the checkmark. */
.listings-map-card-top-right {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Sits over the card's photo fade -- a shadow keeps the solid pill legible
   against a busy photo. */
.listings-map-card-top-right .listings-status-pill {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.listings-map-card-selected-badge {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hover/focus detail ribbon -- recreates the old Map's card-hover reveal.
   Zero additional request: populated only from the Search-summary fields
   already held in ListingsState.results at render time. */
/* A compact corner tag, not a full-card cover -- matches the old mock
   Map's card-hover ribbon, which only ever occupied a small tag sliding
   out from the card's edge. inset:0 here previously covered the entire
   card (including the Add to Client button) on hover, making the card
   unusable while hovered. Sized to its own content (max-width, not a
   fixed box), anchored to the bottom-right corner where the card has no
   other content (the button sits left-aligned in the body column, the
   decorative photo-fade has no interactive content to protect). */
.listings-map-card-ribbon {
    /* Middle-right, matching the old mock Map's .house-details-ribbon
       exactly (right:0; top:50%; translateY(-50%)). */
    position: absolute;
    right: var(--space-2);
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    max-width: 55%;
    width: max-content;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: rgba(20, 18, 15, 0.9);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.listings-map-card:hover .listings-map-card-ribbon,
.listings-map-card:focus-visible .listings-map-card-ribbon,
.listings-map-card:focus-within .listings-map-card-ribbon {
    opacity: 1;
}

.listings-map-card-ribbon span + span {
    opacity: 0.85;
}

/* The ribbon's dark overlay (matching the old mock Map's
   .house-details-ribbon) reads fine as an intentional dark accent against
   every OTHER theme's dark/neutral surfaces, but visibly clashes with
   cloud's light, white/indigo surfaces -- confirmed live: even with the
   text forced to white, a solid near-black tag sitting on a light card
   still doesn't belong. Give it the same light/indigo treatment as every
   other cloud-themed control in this pass (.crm-dir-type-tab,
   .gdocs-scope-btn) instead of just patching the text color. Scoped to
   cloud only -- no other theme is touched. */
body[data-theme="cloud"] .listings-map-card-ribbon {
    background: #ffffff !important;
    border: 1px solid rgba(99, 102, 241, 0.28) !important;
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.16) !important;
}

body[data-theme="cloud"] .listings-map-card-ribbon span {
    color: #1e1b4b !important;
}

/* ── Custom Leaflet marker (divIcon) ────────────────────────────────── */
/* Diamond silhouette, matching the old mock Map's marker language, built
   from CSS only -- no external icon asset. */

/* Leaflet-owned positioning box ONLY -- marker.getElement() returns THIS
   exact div, and Leaflet writes an inline style.transform
   ('translate3d(x,y,0)') directly onto it on every render/pan/zoom. An
   inline style always wins over a stylesheet rule for the same property,
   so a rotate()/scale() declared here would be silently discarded the
   instant Leaflet next repositions the marker -- this was the actual
   root cause of "hover turns green but never visibly grows" (Staging QA,
   2026-09-11): background-color isn't fought by Leaflet's positioning, so
   the color change worked, but transform-based scale never could. Sized
   to iconSize/iconAnchor (26x26 / [13,26]) so the anchor math is
   unaffected; carries no background/border/transform of its own anymore
   -- see .listings-map-marker-pin below for all of that. .highlighted/
   .selected are still toggled on THIS element by setListingsMapHighlight/
   renderListingsMapMarkers (listings.js) -- unchanged -- the rules below
   just read them via a descendant selector instead of styling this node
   directly. */
.listings-map-marker-icon {
    width: 26px;
    height: 26px;
}

/* Coordy-owned inner element -- Leaflet never writes to this node's
   style, so rotate/scale/color/hover states are safe here. Fills the
   outer positioning box exactly (inset:0), so it lines up pixel-for-pixel
   with where the old single-element marker used to render. */
.listings-map-marker-pin {
    position: absolute;
    inset: 0;
    background: var(--accent-primary);
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.listings-map-marker-pin::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: #fff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Hover uses a distinct green (not the purple accent used for .selected)
   so a hovered pin is easy to spot at a glance against the rest of the
   markers on the map. Color applies on every device (unchanged, approved
   behavior); the size bump below is desktop/pointer-hover only (2026-09-11
   "Mobile Map Panel Polish + Desktop Marker Hover Emphasis" ticket) -- see
   the (hover: hover) media block's own comment. */
.listings-map-marker-icon.highlighted .listings-map-marker-pin {
    background: var(--success-solid, #10b981);
}

/* Subtle desktop-only hover scale (~1.14x -- Diego's requested "clearly
   visible but subtle" 1.12-1.16x range, confirmed via real Staging QA that
   the size increase must actually be visible, not merely present in a
   static CSS token). Gated on (hover: hover) and (pointer: fine) so a
   touch tap -- which still toggles .highlighted via the same
   mouseenter/mouseleave listeners on some mobile browsers -- never
   triggers a desktop-only size change on a phone (Part 15 of the prior
   ticket / Step 5 of this one). Placed BEFORE .selected below so, when a
   marker carries both classes (its own card is hovered while it's already
   selected), .selected's unconditional rule -- equal specificity, later in
   source -- still wins the cascade for background/transform, keeping
   selected visually authoritative over hover. transition duration lives
   on .listings-map-marker-pin above (0.15s / 150ms -- inside the
   requested 120-180ms range). */
@media (hover: hover) and (pointer: fine) {
    .listings-map-marker-icon.highlighted .listings-map-marker-pin {
        transform: rotate(-45deg) scale(1.14);
    }
}

.listings-map-marker-icon.selected .listings-map-marker-pin {
    background: var(--accent-strong, var(--accent-primary));
    transform: rotate(-45deg) scale(1.35);
    box-shadow: 0 0 0 4px rgba(180, 138, 99, 0.35), 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* ── Detail modal ────────────────────────────────────────────────────────
   A centered modal (not the old 400px right-side sliding drawer) --
   matches the wider, sectioned "Property Details" treatment. Element IDs
   are unchanged from the old drawer (#listingsDetailDrawer etc.) so
   selectListingsProperty/closeListingsDetailDrawer need no changes; only
   the visual language changed, plus one new wrapping .listings-detail-dialog
   element. Real data only -- no analytics, no amenities, no photos (see
   renderListingsDetailDrawer in listings.js). ─────────────────────────── */

.listings-detail-drawer {
    position: fixed;
    inset: 0;
    /* Must clear the app's persistent header (--z-header, 2000 -- see
       base.css's .header) or the header renders on top of the modal's own
       top edge. 900 was fine for the old right-side drawer, which never
       reached that high; the taller centered modal does. */
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--modal-overlay, rgba(0, 0, 0, 0.55));
}

.listings-detail-drawer.hidden {
    display: none;
}

.listings-detail-dialog {
    width: min(640px, calc(100vw - 24px));
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.listings-detail-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-soft);
    flex-shrink: 0;
}

.listings-detail-drawer-header h2 {
    font-size: 18px;
    margin: 0;
    color: var(--text-primary);
}

.listings-detail-drawer-close {
    appearance: none;
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-md);
}

.listings-detail-drawer-close:hover {
    color: var(--text-primary);
    background: var(--bg-main);
}

.listings-detail-drawer-close:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.listings-detail-drawer-body {
    /* flex: 1 + min-height: 0 are required for overflow-y: auto to actually
       activate inside a flex column whose parent caps height with
       max-height + overflow: hidden (.listings-detail-dialog) -- without
       them this element sizes to its own content instead of the space
       actually available, so long content (the new Property Information
       grid + Description) was being silently clipped by the dialog's
       overflow: hidden instead of scrolling. */
    flex: 1;
    min-height: 0;
    padding: var(--space-5);
    overflow-y: auto;
}

.listings-detail-drawer-body .listings-card-photo-placeholder {
    /* Matches .listings-detail-gallery-hero's height so the
       loading/error/empty states are the same size as the real hero once
       photos load -- no jarring layout shift. */
    height: min(52vw, 420px);
    min-height: 240px;
    border-radius: 0;
    margin-bottom: 0;
}

/* ── Detail hero + gallery (real, policy-approved MIAMI IDX photos,
   2026-09-02 activation) ─────────────────────────────────────────────── */

/* UPDATED 2026-09-05 "Listings Next" ticket -- full-bleed hero. Negative
   top/left/right margins escape .listings-detail-drawer-body's own padding
   so the hero spans essentially the full modal width, right up against
   the header above it; bottom margin is preserved (positive) for spacing
   before the sections below. */
.listings-detail-gallery {
    margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) var(--space-5);
}

.listings-detail-gallery--loading .listings-card-photo-placeholder,
.listings-detail-gallery--empty .listings-card-photo-placeholder {
    margin-bottom: 0;
}

.listings-detail-gallery-hero {
    position: relative;
    /* UPDATED 2026-09-05 -- taller, responsive hero (was a flat 220px);
       no border-radius -- the hero is now full-bleed against the modal's
       straight side edges, not inset with padding around it. */
    height: min(52vw, 420px);
    min-height: 240px;
    overflow: hidden;
    background: var(--bg-main);
}

.listings-detail-gallery-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listings-detail-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    appearance: none;
    width: 36px;
    height: 36px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.listings-detail-gallery-nav:hover {
    background: rgba(0, 0, 0, 0.65);
}

.listings-detail-gallery-nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.listings-detail-gallery-nav--prev {
    left: var(--space-2);
}

.listings-detail-gallery-nav--next {
    right: var(--space-2);
}

.listings-detail-gallery-count {
    position: absolute;
    bottom: var(--space-2);
    right: var(--space-2);
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-variant-numeric: tabular-nums;
}

.listings-detail-gallery-thumbs {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
    overflow-x: auto;
    padding-bottom: 2px;
}

.listings-detail-gallery-thumb {
    appearance: none;
    flex-shrink: 0;
    width: 56px;
    height: 44px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-main);
    opacity: 0.65;
    transition: border-color 0.12s ease, opacity 0.12s ease;
}

.listings-detail-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listings-detail-gallery-thumb:hover {
    opacity: 0.9;
}

.listings-detail-gallery-thumb:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Selected state must read beyond color alone -- border weight/opacity
   both change together, matching the Map card's selected-badge precedent
   (see buildListingsMapCardHtml()'s comment). */
.listings-detail-gallery-thumb.selected {
    border-color: var(--accent-primary);
    opacity: 1;
}

.listings-detail-gallery--error .listings-card-photo-placeholder {
    margin-bottom: var(--space-2);
}

.listings-detail-gallery-error {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.listings-detail-gallery-retry {
    appearance: none;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
}

.listings-detail-gallery-retry:hover,
.listings-detail-gallery-retry:focus-visible {
    border-color: var(--accent-primary);
    color: var(--accent-strong);
    outline: none;
}

/* ── Lightbox (2026-09-05 "Listings Next" ticket) ───────────────────────
   Modal-within-modal enlarged photo viewer, layered above the Detail
   modal (z-index 2100) -- see initListingsLightboxOnce()/
   openListingsLightbox() in listings.js. Reuses the exact same photo list
   and index as the inline gallery; never its own source of Media. */

.listings-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    flex-direction: column;
    background: rgba(0, 0, 0, 0.9);
    padding: var(--space-4);
}

.listings-lightbox.hidden {
    display: none;
}

.listings-lightbox-close {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    z-index: 1;
    appearance: none;
    border: none;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.listings-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
}

.listings-lightbox-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.listings-lightbox-stage {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: var(--space-3);
}

.listings-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.listings-lightbox-nav {
    appearance: none;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.listings-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.listings-lightbox-nav:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.listings-lightbox-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-3);
}

.listings-lightbox-count {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.listings-lightbox-thumbs {
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: 2px;
}

.listings-lightbox-thumb {
    appearance: none;
    flex-shrink: 0;
    width: 56px;
    height: 44px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    opacity: 0.6;
    background: transparent;
}

.listings-lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.listings-lightbox-thumb:hover {
    opacity: 0.85;
}

.listings-lightbox-thumb:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.listings-lightbox-thumb.selected,
.listings-lightbox-thumb[aria-current="true"] {
    border-color: #fff;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .listings-lightbox,
    .listings-lightbox-img {
        transition: none !important;
        animation: none !important;
    }
}

@media (max-width: 640px) {
    /* Near-fullscreen on mobile -- no side padding to waste on a narrow
       viewport, larger stage, thumbnail strip still scrollable. */
    .listings-lightbox {
        padding: var(--space-2);
    }
    .listings-lightbox-nav {
        width: 44px;
        height: 44px;
    }
}

.listings-detail-attribution {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

@media (prefers-reduced-motion: reduce) {
    .listings-detail-gallery-nav,
    .listings-detail-gallery-thumb {
        transition: none;
    }
}

.listings-detail-intent-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.listings-detail-intent-badge {
    background: var(--accent-primary);
    color: var(--accent-on-primary, #fff);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.listings-detail-status-badge {
    /* Color/contrast comes from .listings-status-pill and its
       --positive/--pending/--neutral modifier -- only the Detail-specific
       sizing/typography overrides live here. */
    padding: 3px 10px;
    font-size: 11px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.listings-detail-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.listings-detail-address {
    font-size: 16px;
    font-weight: 600;
    margin-top: 4px;
    color: var(--text-primary);
}

.listings-detail-city {
    font-size: 13px;
    color: var(--text-muted);
}

.listings-detail-mls {
    flex-wrap: wrap;
    margin-top: var(--space-3);
    font-size: 13px;
}

.listings-detail-copy-mls {
    appearance: none;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    min-height: 28px;
    padding: 6px 10px;
    transition: border-color 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.listings-detail-copy-mls:hover,
.listings-detail-copy-mls:focus-visible {
    background: var(--bg-main);
    border-color: var(--accent-primary);
    color: var(--accent-strong);
    outline: none;
}

.listings-detail-copy-mls-status {
    min-height: 16px;
    color: var(--success-solid, #059669);
    font-size: 12px;
}

.listings-detail-copy-mls-status--error {
    color: var(--danger-solid, #dc2626);
}

.listings-detail-facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.listings-detail-facts span {
    background: var(--bg-main);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.listings-detail-load-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-muted);
    font-size: 13px;
}

.listings-detail-load-state--ready {
    color: var(--success-solid, #059669);
}

.listings-detail-load-state--error {
    color: var(--danger-solid, #dc2626);
}

.listings-detail-section {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-soft);
}

.listings-detail-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 var(--space-3);
}

.listings-detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-3);
}

.listings-detail-info-item {
    background: var(--bg-main);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.listings-detail-info-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.listings-detail-info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 2px;
}

.listings-detail-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.listings-detail-chip-list span,
.listings-detail-chip-list button {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-full);
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.listings-detail-chip-list .listings-detail-chip-more {
    appearance: none;
    font: inherit;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.listings-detail-chip-list .listings-detail-chip-more:hover,
.listings-detail-chip-list .listings-detail-chip-more:focus-visible {
    background: var(--bg-card);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    outline: none;
}

.listings-detail-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary, var(--text-primary));
    white-space: pre-line;
}

.listings-detail-actions {
    display: flex;
    align-items: stretch;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.listings-detail-actions > .btn {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
    min-height: 56px;
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

@media (max-width: 640px) {
    .listings-detail-dialog {
        width: 100%;
        max-height: calc(100dvh - 16px);
    }

    .listings-detail-actions {
        flex-direction: column;
    }

    .listings-detail-gallery-hero {
        height: 180px;
    }
}

/* Add to Client modal */

.listings-add-client-overlay {
    position: fixed;
    inset: 0;
    /* See .listings-detail-drawer's comment -- must clear the app header's
       z-index (--z-header, 2000). 1200 hadn't visibly broken here yet only
       because this modal's content rarely reaches that high. */
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--modal-overlay, rgba(0, 0, 0, 0.55));
}

.listings-add-client-overlay.hidden {
    display: none;
}

.listings-add-client-dialog {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.listings-add-client-header {
    display: flex;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.listings-add-client-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.listings-add-client-header p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.listings-add-client-close {
    appearance: none;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.listings-add-client-close:hover,
.listings-add-client-close:focus-visible {
    background: var(--bg-main);
    color: var(--text-primary);
    outline: none;
}

.listings-add-client-body {
    /* See .listings-detail-drawer-body's comment -- required for
       overflow-y: auto to activate instead of being silently clipped by
       the dialog's own max-height + overflow: hidden. */
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    overflow-y: auto;
}

.listings-add-client-body label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.listings-add-client-search {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
    padding: 0 var(--space-3);
    font: inherit;
}

.listings-add-client-search:focus-visible {
    border-color: var(--accent-primary);
    outline: 2px solid var(--accent-primary);
    outline-offset: 1px;
}

.listings-add-client-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-height: 120px;
    max-height: 280px;
    overflow-y: auto;
}

.listings-add-client-option {
    appearance: none;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background: var(--bg-main);
    color: var(--text-primary);
    padding: var(--space-3);
    cursor: pointer;
    text-align: left;
}

.listings-add-client-option:hover,
.listings-add-client-option:focus-visible,
.listings-add-client-option.selected {
    border-color: var(--accent-primary);
    outline: none;
}

.listings-add-client-option.selected {
    box-shadow: 0 0 0 2px var(--accent-primary) inset;
}

.listings-add-client-option small,
.listings-add-client-message,
.listings-add-client-status {
    color: var(--text-muted);
    font-size: 12px;
}

.listings-add-client-status.success,
.listings-add-client-status.already-added {
    color: var(--success, #047857);
    font-weight: 700;
}

.listings-add-client-status.error {
    color: var(--danger, #b91c1c);
    font-weight: 700;
}

.listings-add-client-status.loading {
    color: var(--text-primary);
}

.listings-add-client-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--border-soft);
    background: var(--bg-card);
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .listings-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .listings-filter-field,
    .listings-filter-field--narrow {
        flex: 1 1 auto;
        width: 100%;
    }

    .listings-filter-actions {
        margin-left: 0;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .listings-filter-actions .btn {
        width: 100%;
    }

    .listings-cards {
        grid-template-columns: 1fr;
    }

    /* Mobile Map layout ("Mobile Map Panel Polish" ticket, 2026-09-11) --
       stacks the side panel below the map (same DOM order as desktop's
       upside-down-L, just single-column) rather than beside it. Chosen over
       a draggable/resizable bottom sheet: this app has no bottom-sheet
       primitive anywhere else, and Diego's own preferred layout (a fixed
       map region, then a results region below it) doesn't need drag-resize
       behavior to satisfy -- see Part 4/5 of the ticket. Map gets
       ~40-50% of the viewport (clamped so it stays usable on both a short
       and a tall phone); the results panel below it gets its own real
       height (not the old "auto + 320px cap", which squeezed client
       search + quick filter + header + cards into barely more space than
       a single card) so several cards are comfortably browsable. The page
       itself is allowed to scroll below this -- same "generous minimum,
       never a shrinking ceiling" philosophy documented on
       computeListingsMapWorkspaceHeight in listings.js for desktop, just
       CSS-only here since mobile never runs that runtime measurement (see
       LISTINGS_MAP_WORKSPACE_TABLET_BREAKPOINT's own comment). */
    .listings-map-container-wrap {
        height: clamp(280px, 42dvh, 420px);
    }

    .listings-map-view.active {
        grid-template-columns: 1fr;
        /* The fixed .mobile-bottom-nav (mobile.css, ~58px + safe-area) sits
           on top of the page and isn't otherwise cleared here -- #mapPage
           is a bare .listings-workspace, not the .page-content wrapper
           that carries the codebase's generic bottom-nav padding (Part 9,
           "Staging QA Fix" ticket, 2026-09-11). Without this, the page's
           own scroll could bottom out with Load More/Compare/Add to Client
           sitting behind the nav. Buffer matches the established
           calc(58px + safe-area + extra) pattern used elsewhere in
           mobile.css. */
        padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px) + 16px);
    }

    /* Results panel: substantially taller than the map (Diego's Staging QA,
       2026-09-11 -- the prior clamp(420px, 46dvh, 640px) still only
       surfaced ~1 usable card with the client panel collapsed). Target is
       roughly 4-5 property cards visible/browsable before the panel's own
       internal scroll (.listings-map-panel-cards) takes over, derived from
       real content, not a guess: each Map card is ~117px (see
       .listings-map-panel-cards's own comment) + 6px inter-card gap =
       ~123px/card, plus chrome above the card list -- collapsed/empty
       client row (~40-60px), quick filter (~45px), sticky "Available
       Properties" header (~44px), card-list padding (24px) -- roughly
       150-175px. 4 cards -> ~640-665px total; 5 cards -> ~765-790px. The
       page is explicitly allowed to scroll (same "generous minimum, never
       a shrinking ceiling" philosophy as the desktop workspace height) so
       this uses a real floor (700px) rather than shrinking to fit
       whatever's left in a short viewport -- the dvh mid-point still lets
       a genuinely tall phone (e.g. 430x932) get a bit more. */
    .listings-map-side-panel {
        height: clamp(700px, 88dvh, 900px);
        max-height: none;
    }

    /* Client panel: especially compact collapsed (Part 6) -- the row's own
       ellipsis-truncated name/summary already keep it to one line; this
       only tightens the padding around it. Preferences/state themselves
       are completely untouched (same collapsed/expanded JS/state as
       desktop -- see renderListingsClientSelected's own comment). */
    .listings-client-search {
        padding: var(--space-2) var(--space-3);
    }

    .listings-client-selected {
        padding: 6px var(--space-2);
    }

    /* Expanded state may show full preference detail, but it must never
       be able to push the results list off-screen on a short phone -- caps
       just the chip content (the actual potentially-long, variable-length
       part) rather than the whole panel, so name/summary/collapse control
       stay reachable no matter how many preferences a client has. */
    .listings-client-selected:not(.collapsed) .listings-client-chips {
        max-height: 160px;
        overflow-y: auto;
    }

    /* Map card actions: larger tap area than the ~21px-tall desktop-sized
       buttons (Part 7/16) without breaking the card's approved compact
       density -- see this ticket's final report for why this stops short
       of the full 44px WCAG target here specifically. */
    .listings-map-add-client-btn,
    .listings-map-compare-btn {
        min-height: 34px;
        padding: 6px 10px;
    }

    .listings-detail-drawer {
        width: 100vw;
    }

    .listings-advanced-backdrop {
        background: rgba(0, 0, 0, 0.32);
    }

    /* All Filters -- full-screen on mobile (Step 5/22), not a shrunken
       version of the desktop modal. The category sidebar nav is hidden
       here rather than reflowed into a horizontal tab strip -- the
       existing per-category <details>/<summary> accordion already gives
       mobile a fully accessible, one-column way to jump between sections
       (tap a closed section to expand it), which is exactly the
       "accessible accordion if simpler and cleaner" fallback Step 22
       explicitly allows instead of a second in/out category-screen flow. */
    .listings-advanced-drawer {
        top: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        transform: none;
        border: none;
        border-radius: 0;
    }

    .listings-advanced-drawer.hidden {
        transform: none;
    }

    .listings-advanced-category-nav {
        display: none;
    }

    .listings-advanced-section-body {
        grid-template-columns: 1fr;
    }

    .listings-advanced-minmax {
        grid-template-columns: 1fr;
    }

    .listings-advanced-footer {
        padding-bottom: max(var(--space-4), env(safe-area-inset-bottom));
    }

    .listings-add-client-overlay {
        align-items: flex-end;
        padding: var(--space-3);
    }

    .listings-add-client-dialog {
        width: 100%;
        max-height: calc(100dvh - 24px);
    }

    .listings-add-client-footer {
        flex-direction: column-reverse;
    }

    .listings-add-client-footer .btn {
        width: 100%;
    }
}

/* ── Compare modal ───────────────────────────────────────────────────── */
/* Sourced exclusively from ListingsState.results already in memory --
   same rule as the Map cards. See toggleListingsCompare()/
   renderListingsCompareModal() in listings.js. */

.listings-compare-overlay {
    position: fixed;
    inset: 0;
    /* See .listings-detail-drawer's comment -- must clear the app header's
       z-index (--z-header, 2000). */
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: var(--modal-overlay, rgba(0, 0, 0, 0.55));
}

.listings-compare-overlay.hidden {
    display: none;
}

/* UPDATED 2026-09-05 "Listings Next" ticket -- was min(920px, ...) /
   calc(100dvh - 32px); Diego's ask was "significantly larger on desktop,"
   ~1200-1400px, ~90vh. */
.listings-compare-dialog {
    width: min(1320px, calc(100vw - 24px));
    max-height: min(calc(100dvh - 32px), 90vh);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.listings-compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-soft);
}

.listings-compare-header h2 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.listings-compare-close {
    appearance: none;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.listings-compare-close:hover,
.listings-compare-close:focus-visible {
    background: var(--bg-main);
    color: var(--text-primary);
    outline: none;
}

.listings-compare-body {
    /* See .listings-detail-drawer-body's comment -- required for
       overflow: auto to activate instead of being silently clipped by
       the dialog's own max-height + overflow: hidden. */
    flex: 1;
    min-height: 0;
    padding: var(--space-4);
    overflow: auto;
}

.listings-compare-empty {
    color: var(--text-muted);
    font-size: 13px;
}

/* REVERTED 2026-09-09 "Staging QA Regression Fix" ticket -- Diego rejected
   the 2026-09-05 spreadsheet/table redesign's visual structure (columns =
   properties, rows = attributes) and asked for the PRIOR card-based
   language back: equal-width property cards, side by side, each with the
   same internal structure/row order. The table pass's real underlying
   improvements -- larger modal, larger photos, richer fields, status
   pills, empty-value handling -- are kept, just expressed inside cards
   again. See buildListingsCompareCardHtml()/buildListingsCompareCardRowsHtml()
   in listings.js. */

.listings-compare-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    align-items: start;
}

/* 2 properties: still equal-width, but capped/centered rather than
   stretching two giant cards across the full 1320px dialog. */
.listings-compare-cards--count-1,
.listings-compare-cards--count-2 {
    grid-template-columns: repeat(auto-fit, minmax(0, 420px));
    justify-content: center;
}

.listings-compare-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.listings-compare-remove-btn {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    z-index: 1;
    appearance: none;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-soft);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
}

.listings-compare-remove-btn:hover,
.listings-compare-remove-btn:focus-visible {
    color: var(--text-primary);
    border-color: var(--accent-primary);
    outline: none;
}

/* Bigger images (kept from the table pass) -- was 100px pre-redesign.
   Image availability never changes card sizing: a placeholder occupies the
   exact same box as a real photo (both use .listings-card-photo-placeholder). */
.listings-compare-card .listings-card-photo-placeholder {
    position: relative;
    height: 190px;
    border-radius: 0;
    margin: 0;
}

.listings-compare-card-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) var(--space-4) var(--space-4);
}

.listings-compare-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 6px;
}

.listings-compare-address {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.listings-compare-city {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.listings-compare-card-mls {
    margin: 2px 0;
}

.listings-compare-card-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: var(--space-2) 0 var(--space-3);
}

.listings-compare-intent-pill {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
}

.listings-compare-card-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    border-top: 1px solid var(--border-soft);
}

.listings-compare-card-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-soft);
}

.listings-compare-card-row:last-child {
    border-bottom: none;
}

.listings-compare-row-label {
    margin: 0;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.listings-compare-row-value {
    margin: 0;
    text-align: right;
    color: var(--text-primary);
    font-size: 13px;
}

.listings-compare-row-empty {
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .listings-compare-cards,
    .listings-compare-cards--count-1,
    .listings-compare-cards--count-2 {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .listings-compare-overlay {
        align-items: flex-end;
        padding: var(--space-3);
    }

    .listings-compare-dialog {
        width: 100%;
        max-height: calc(100dvh - 24px);
    }

    .listings-compare-card .listings-card-photo-placeholder {
        height: 160px;
    }
}
