/* ============================================================================
   Morning Report — "Aero-Digital Terminal" (subtle / professional)
   Self-contained: no Tailwind, no build step. Pairs with Isotope (filtering)
   and Bootstrap's JS (modals only). Design tokens from redesign DESIGN.md.
   ========================================================================== */

:root {
    --surface:            #0d151f;
    --surface-low:        #0f1d33;
    --surface-container:  #14233d;
    --surface-high:       #1c2e4d;
    --surface-lowest:     #060e1a;
    --on-surface:         #dde3ec;
    --on-surface-variant: #8b97ac;
    --outline:            #3f4a61;
    --ghost-border:       rgba(150, 172, 208, 0.14);
    --ghost-border-soft:  rgba(150, 172, 208, 0.07);

    --yellow:  #fde400;
    --green:   #35d17a;
    --cyan:    #4cd6ff;
    --red:     #ffb4ab;
    --oh-blue: #2f80ff; /* open houses — keep in sync with PIN_COLORS in scripts.js */
    --on-yellow: #201c00;

    --radius-sm: 0.125rem;
    --radius:    0.25rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;

    --gutter: 1rem;
    --margin: 2rem;

    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--surface);
    color: var(--on-surface);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

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

a { color: var(--cyan); text-decoration: none; }
a:hover { color: #fff; }

/* mono helper + tabular numerals for aligned data */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- header */
.mr-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem var(--margin);
    /* cool light header bar with dark-navy content */
    background: #d9dee6;
    border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.mr-brand { display: flex; align-items: center; gap: 0.75rem; }
.mr-brand img { height: 1.75rem; width: auto; display: block; filter: brightness(0); } /* white SG mark -> black on yellow */
.mr-brand .title {
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 1.05rem;
    color: #0a1422;
}
.mr-header .status-dot {
    width: 0.5rem; height: 0.5rem; border-radius: 9999px;
    background: #0a1422;
    animation: mr-pulse 2s infinite;
}
@keyframes mr-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.mr-clock {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.1rem;
    color: #0a1422;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}
/* dark icon button on the yellow bar */
.mr-header .mr-iconbtn { color: #0a1422; border-color: rgba(0, 0, 0, 0.3); }
.mr-header .mr-iconbtn:hover { background: rgba(0, 0, 0, 0.12); border-color: rgba(0, 0, 0, 0.55); color: #0a1422; }
.mr-header-actions { display: flex; align-items: center; gap: 0.5rem; }
.mr-iconbtn {
    background: transparent;
    border: 1px solid var(--ghost-border);
    color: var(--on-surface-variant);
    width: 2.25rem; height: 2.25rem;
    border-radius: var(--radius);
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.mr-iconbtn:hover { border-color: var(--yellow); color: var(--yellow); }

/* ----------------------------------------------------------------- layout */
.mr-main {
    flex: 1 0 auto;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem var(--margin) 4rem;
}
/* white notch flush to the screen's left edge, spanning the full height of the
   header + controls block (rounded tip, concave fillets where it meets the edge) */
.mr-section-panel { position: relative; }
/* Soft blue-white left-edge notch (kit funnel shape). Document-positioned so its
   header default scrolls away with the page; JS flows it to the hovered card's row. */
.mr-flow-notch {
    position: absolute; left: 0; top: 87px; width: 12px; height: 112px; z-index: 25;
    background: #d9dee6; pointer-events: none;
    clip-path: path("M 0 112 A 8 8 0 0 1 8 104 L 4 104 A 6 6 0 0 0 10 98 L 10 14 A 6 6 0 0 0 4 8 L 8 8 A 8 8 0 0 1 0 0 L 0 112 Z");
    transition: top 0.45s cubic-bezier(0.34, 1.2, 0.64, 1),
                height 0.45s cubic-bezier(0.34, 1.2, 0.64, 1),
                clip-path 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}
@media (max-width: 1023px) { .mr-flow-notch { display: none; } }

.mr-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
}
.mr-section-head .mr-filters-btn { flex-shrink: 0; }
.mr-section-head h2 {
    font-family: var(--mono);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #fff;
    font-size: 1.35rem;
    margin: 0;
}
.mr-section-head .sub {
    color: var(--on-surface-variant);
    font-size: 0.9rem;
}

/* ----------------------------------------------------------- filter chips */
.mr-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.5rem;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--ghost-border);
}
.mr-control-group .label {
    display: block;
    font-family: var(--mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    margin-bottom: 0.4rem;
}
.mr-control-row { display: contents; }

/* cold-load overlay — shown immediately (flushed before the data fetch),
   removed by scripts.js once the grid is laid out */
.mr-loading {
    position: fixed; inset: 0; z-index: 2000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1.1rem; background: var(--surface); transition: opacity 0.35s ease;
}
.mr-loading.is-done { opacity: 0; pointer-events: none; }
.mr-loading p {
    margin: 0; font-family: var(--mono); font-size: 0.72rem;
    letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-surface-variant);
}
.mr-spinner {
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    border: 3px solid var(--ghost-border); border-top-color: var(--yellow);
    animation: mr-spin 0.8s linear infinite;
}
@keyframes mr-spin { to { transform: rotate(360deg); } }
.mr-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mr-chip {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.35rem 0.7rem;
    background: transparent;
    color: var(--on-surface-variant);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.mr-chip:hover { border-color: rgba(255,255,255,0.4); color: #fff; }
.mr-chip.is-checked {
    background: var(--yellow);
    color: var(--on-yellow);
    border-color: var(--yellow);
}
.mr-chip .bi { font-size: 0.7rem; }
.mr-filter-count {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--on-surface-variant);
    margin: 0 0 1.25rem;
}
.mr-filter-count span { color: var(--yellow); font-weight: 700; }
.mr-reset-link {
    margin-left: 0.85rem; color: var(--cyan); text-decoration: none;
    font-weight: 700; letter-spacing: 0.06em; white-space: nowrap;
}
.mr-reset-link:hover { text-decoration: underline; }
.mr-reset-link .bi { font-size: 0.7rem; }
.mr-reset-link[hidden] { display: none; }

/* count + expand-all toggle row */
.mr-listings-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem;
}
.mr-listings-bar .mr-filter-count { margin: 0; }

/* city dropdown filter */
.mr-select {
    font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase;
    background-color: transparent; color: var(--on-surface);
    border: 1px solid var(--ghost-border); border-radius: var(--radius);
    padding: 0.35rem 1.9rem 0.35rem 0.7rem; cursor: pointer;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8a496' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.55rem center; background-size: 0.7rem;
    max-width: 14rem;
}
.mr-select:hover { border-color: rgba(255,255,255,0.4); }
.mr-select:focus { outline: none; border-color: var(--yellow); }
.mr-select option { background: var(--surface-container); color: var(--on-surface); text-transform: none; }

/* ----------------------------------------------------------------- grid */
.isogrid { width: 100%; }
.listing-item {
    width: 100%;
    padding: 0 calc(var(--gutter) / 2) var(--gutter);
    float: left;
}
@media (min-width: 640px)  { .listing-item { width: 50%; } }       /* 2 up */
@media (min-width: 1280px) { .listing-item { width: 33.3333%; } }  /* 3 up (down to 1280) */
@media (min-width: 1440px) { .listing-item { width: 25%; } }       /* 4 up */
@media (min-width: 1920px) { .listing-item { width: 20%; } }       /* 5 up on very wide */

/* ------------------------------------------------- two-column main layout */
.mr-layout { display: flex; gap: 2.5rem; align-items: flex-start; }
.mr-listings-col { flex: 1 1 auto; min-width: 0; }
.mr-rates-col {
    flex: 0 0 340px;
    border-left: 1px solid var(--ghost-border);
    padding-left: 1.75rem;
    position: sticky;
    top: 4.75rem;
}
@media (max-width: 1023px) {
    .mr-layout { flex-direction: column; }
    /* rates move to the top on stacked layouts, as a clean collapsible card */
    .mr-rates-col {
        order: -1;
        flex-basis: auto; width: 100%;
        border-left: none; padding-left: 0;
        position: static; margin-bottom: 1.5rem;
    }
    .rates-panel {
        border: 1px solid var(--ghost-border);
        border-radius: var(--radius-lg);
        background: var(--surface-low);
        padding: 0.9rem;
    }
}

/* ------------------------------------------------------- rates table panel */
.rates-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.rates-head h2 {
    font-family: var(--mono); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.02em; font-size: 1.1rem; color: #fff; margin: 0;
}
.rates-head .rates-logo { height: 1.4rem; width: auto; opacity: 0.95; }
.rates-table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.rates-table th {
    text-align: left; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--on-surface-variant);
    padding: 0.4rem 0.3rem; border-bottom: 1px solid var(--ghost-border);
}
.rates-table th.num, .rates-table td.num { text-align: right; }
.rates-table td { padding: 0.6rem 0.3rem; border-bottom: 1px solid var(--ghost-border-soft); font-size: 0.82rem; }
.rates-table tbody tr:nth-child(odd) td { background: rgba(255,255,255,0.02); }
.rates-table .rate-program { color: var(--on-surface); }
.rates-table .rate-value { color: var(--yellow); font-weight: 700; }
.rates-table .rate-apr { color: var(--on-surface-variant); font-size: 0.76rem; }
/* timestamp now sits above the table */
.rates-live {
    display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem;
    font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--on-surface-variant);
}
.rates-live .status-dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: var(--green); box-shadow: 0 0 6px var(--green); }

/* rate disclaimer: toggle (with equal-housing icon) + collapsible text */
.rates-disc-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: none; border: 0; cursor: pointer; padding: 0.7rem 0 0;
    font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--cyan);
}
.rates-disc-toggle .rates-eh { height: 1.4rem; width: auto; }
.rates-disc-toggle .bi { transition: transform 0.3s ease; }
.rates-disc.is-open .rates-disc-toggle .bi { transform: rotate(180deg); }
/* animate the disclaimer open/closed via grid-rows (0fr -> 1fr) */
.rates-disclaimer {
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.7rem; line-height: 1.5; color: var(--on-surface-variant);
}
.rates-disclaimer > span { overflow: hidden; min-height: 0; }
.rates-disc.is-open .rates-disclaimer { grid-template-rows: 1fr; margin-top: 0.6rem; }

/* Contact a Loan Officer — centered */
.rates-cta { margin-top: 1.1rem; text-align: center; }
.rates-cta .mr-btn { display: inline-block; width: auto; padding-left: 1.5rem; padding-right: 1.5rem; }

/* show/hide the rate table (default expanded), animated via grid-rows */
.rates-collapse {
    display: grid; grid-template-rows: 1fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.rates-collapse-inner { overflow: hidden; min-height: 0; }
.rates-panel.is-collapsed .rates-collapse { grid-template-rows: 0fr; }
.rates-show-toggle {
    display: block; width: 100%; text-align: center;
    background: none; border: 0; border-top: 1px solid var(--ghost-border-soft);
    margin-top: 1rem; padding: 0.75rem 0 0; cursor: pointer;
    font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--cyan);
}
.rates-show-toggle .bi { transition: transform 0.3s ease; }
.rates-panel.is-collapsed .rates-show-toggle .bi { transform: rotate(180deg); }

/* On desktop the rates sidebar is always open — drop the collapse/disclaimer
   toggles and just show everything (the equal-housing mark stays as a static
   badge above the always-visible disclaimer). */
@media (min-width: 1024px) {
    .rates-show-toggle { display: none; }
    .rates-panel.is-collapsed .rates-collapse { grid-template-rows: 1fr; }
    .rates-disclaimer { grid-template-rows: 1fr; margin-top: 0.6rem; }
    .rates-disc-toggle { pointer-events: none; cursor: default; padding-top: 0.7rem; }
    .rates-disc-toggle .rdt-label, .rates-disc-toggle .bi { display: none; }
}

/* --------------------------------------------------------------- cards
   Compact by default; expands in place on hover (over neighbors, no reflow,
   since Isotope laid the grid out at the compact height). Click opens the
   full-detail modal. */
.listing-item { z-index: 1; }
.isogrid .listing-item:hover,
.isogrid .listing-item:focus-within { z-index: 30; }

.prop-card {
    position: relative;
    --status: var(--outline);
    background: var(--surface-low);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: box-shadow 0.2s;
    outline: none;
}
.prop-card.status-new        { --status: var(--green); }
.prop-card.status-coming     { --status: var(--cyan); }
.prop-card.status-registered { --status: var(--yellow); }
.prop-card.status-buyer      { --status: #d0bcff; }
/* status outline as a top overlay so the photo can't cover it (sits below the
   notch fill, which keeps the notch mouth open) */
.prop-card::after {
    content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status) 45%, transparent);
}
/* status-filled filleted notch on the left edge — GRID cards only (not the modal).
   Kit geometry: 8px outward fillets + 6px inner corners, 10px deep. Drawn as a
   status-colored overlay clipped to the notch path; grows down on expand. */
.listing-item .prop-card::before {
    content: ""; position: absolute; left: 0; top: 0; width: 11px; height: 100%; z-index: 4;
    background: var(--status);
    clip-path: path("M 0 53 A 8 8 0 0 1 8 45 L 4 45 A 6 6 0 0 0 10 39 L 10 27 A 6 6 0 0 0 4 21 L 8 21 A 8 8 0 0 1 0 13 L 0 53 Z");
    transition: clip-path 0.6s cubic-bezier(0.33, 1.15, 0.64, 1);
}
.listing-item.is-expanded .prop-card::before {
    clip-path: path("M 0 119 A 8 8 0 0 1 8 111 L 4 111 A 6 6 0 0 0 10 105 L 10 27 A 6 6 0 0 0 4 21 L 8 21 A 8 8 0 0 1 0 13 L 0 119 Z");
}

/* Expansion is driven by the .is-expanded class (added on hover via JS) so
   Isotope can re-layout and push neighbors down instead of overlapping them. */
.listing-item.is-expanded { z-index: 5; }
.listing-item.is-expanded .prop-card {
    box-shadow: 0 14px 34px rgba(0,0,0,0.5);
}
.listing-item.is-expanded .prop-card::after {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--status) 85%, transparent);
}
.card-reveal { display: none; }
/* slower open with a gentle settle (just a hint of give, no jiggle) */
.listing-item.is-expanded .card-reveal { display: block; animation: cardReveal 0.6s cubic-bezier(0.25, 0.9, 0.3, 1); }
@keyframes cardReveal {
    0%   { opacity: 0; transform: translateY(-14px); }
    65%  { opacity: 1; transform: translateY(2px); }   /* slight overshoot */
    100% { opacity: 1; transform: translateY(0); }
}

/* status header strip */
.card-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.7rem 0.45rem 1.2rem; /* extra left so content clears the notch */
    border-bottom: 1px solid var(--ghost-border-soft);
}
.card-status {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.card-status::before {
    content: "";
    width: 0.5rem; height: 0.5rem;
    border-radius: 9999px;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}
.card-type {
    font-family: var(--mono);
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--on-surface-variant);
}
/* status colors */
.status-new      .card-status { color: var(--green); }
.status-coming   .card-status { color: var(--cyan); }
.status-registered .card-status { color: var(--yellow); }
.status-buyer    .card-status { color: #d0bcff; }

/* photo */
.card-photo {
    position: relative;
    height: 9rem;
    background: var(--surface-lowest);
    overflow: hidden;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-photo.placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
    background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.05), transparent 70%), var(--surface-lowest);
    color: var(--outline);
}
.card-photo.placeholder i { font-size: 2rem; opacity: 0.9; }
.card-photo.placeholder .ph-label {
    font-family: var(--mono); font-size: 0.62rem; font-weight: 700;
    letter-spacing: 0.14em; text-transform: uppercase;
}
/* tint the placeholder icon with the card's status color */
.status-registered .card-photo.placeholder i { color: var(--yellow); }
.status-buyer .card-photo.placeholder i { color: #d0bcff; }
.status-new .card-photo.placeholder i { color: var(--green); }
.status-coming .card-photo.placeholder i { color: var(--cyan); }

/* compact region (always visible); fixed height keeps every collapsed card uniform
   (all fields are single lines, so nothing clips) */
.card-compact { position: relative; padding: 0.55rem 0.7rem 0.65rem 1.2rem; display: flex; flex-direction: column; gap: 0.12rem; height: 6.25rem; }
.card-reveal .card-photo { height: 7.5rem; }
.card-hint {
    padding: 0.55rem 0.85rem 0.7rem;
    font-family: var(--mono); font-size: 0.62rem; font-weight: 700;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--yellow);
    display: flex; align-items: center;
}
.card-price {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.card-specs {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--on-surface-variant);
    letter-spacing: 0.04em;
}
.card-address {
    font-family: var(--sans);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-city { font-size: 0.8rem; color: var(--on-surface-variant); }
.status-buyer .card-price { font-size: 1.1rem; }
.card-agent {
    padding: 0.6rem 0.85rem;
    font-size: 0.78rem;
    color: var(--on-surface-variant);
}
.card-agent .name { color: var(--on-surface); font-weight: 500; }

/* "Host:" prefix on open-house cards, where the agent line names the host. */
.card-agent-label {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--oh-blue);
}

.card-actions { display: flex; gap: 0.4rem; margin-top: 0.6rem; }

/* terminal buttons */
.mr-btn {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--ghost-border);
    background: transparent;
    color: var(--on-surface);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.mr-btn:hover { border-color: var(--yellow); color: var(--yellow); }
.mr-btn-primary {
    background: var(--yellow);
    color: var(--on-yellow);
    border-color: var(--yellow);
    flex: 1;
}
.mr-btn-primary:hover { filter: brightness(1.1); color: var(--on-yellow); }
.mr-btn-ghost { flex: 1; }

/* ---------------------------------------------------------- rates board */
.mr-rates {
    margin-top: 3rem;
    background: var(--surface-low);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem var(--margin);
}
.mr-rates-head {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--ghost-border);
}
.mr-rates-head h2 {
    font-family: var(--mono); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.02em; font-size: 1.15rem; color: #fff; margin: 0;
}
.mr-rates-head img { height: 1.5rem; width: auto; opacity: 0.9; }
.mr-rate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}
.mr-rate-cell {
    padding: 0.75rem 1rem;
    border: 1px solid var(--ghost-border-soft);
    border-radius: var(--radius);
    background: var(--surface);
}
.mr-rate-cell .type {
    font-family: var(--mono); font-size: 0.65rem; font-weight: 500;
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--on-surface-variant); display: block; margin-bottom: 0.3rem;
}
.mr-rate-cell .rate {
    font-family: var(--mono); font-weight: 700; font-size: 1.35rem; color: var(--yellow);
    font-variant-numeric: tabular-nums; line-height: 1;
}
.mr-rate-cell .apr {
    font-family: var(--mono); font-size: 0.72rem; color: var(--on-surface-variant);
    display: block; margin-top: 0.25rem;
}
.mr-rates-foot {
    margin-top: 1.25rem;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem;
    justify-content: space-between;
}
.mr-rates-foot .disclaimer { flex: 1; min-width: 240px; }
.mr-rates-foot img { height: 1.5rem; }

/* ---------------------------------------------------------------- footer */
.mr-footer {
    flex-shrink: 0;
    background: var(--surface-lowest);
    border-top: 1px solid var(--ghost-border-soft);
    padding: 1.25rem var(--margin);
    display: flex; flex-wrap: wrap; gap: 0.75rem;
    align-items: center; justify-content: space-between;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--on-surface-variant);
    text-transform: uppercase;
}
.mr-footer .brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; }

/* Filters button lives in the listings bar; only needed on mobile */
.mr-bar-actions { display: flex; gap: 0.4rem; }
.mr-filters-btn { display: none; }
.mr-filters-btn .filt-chev { font-size: 0.65rem; transition: transform 0.2s; }
.mr-filters-btn.is-active {
    background: var(--yellow); color: var(--on-yellow); border-color: var(--yellow);
}
.mr-filters-btn.is-active .filt-chev { transform: rotate(180deg); }
@media (max-width: 767px) {
    .mr-controls.is-collapsed { display: none; }
    .mr-filters-btn { display: inline-flex; }
    /* declutter the header on small screens */
    .mr-header { padding: 0.6rem 1rem; gap: 0.5rem; }
    .mr-brand .status-dot { display: none; }
    .mr-brand .title { font-size: 0.95rem; }
    .mr-clock { font-size: 0.95rem; }
    .mr-main { padding-left: 1rem; padding-right: 1rem; }
}

/* ----------------------------------------------------- Bootstrap modals
   Markup stays Bootstrap-4 compatible (bootstrap.bundle.js drives show/hide);
   only the look is themed here. */
.modal-content.prop-card {
    background: var(--surface-low);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-lg);
    color: var(--on-surface);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}
.modal-content .card-body-price {
    background: var(--surface-container);
    border-bottom: 1px solid var(--ghost-border-soft);
    position: relative;
}
.modal-content .modal-title {
    font-family: var(--mono); font-weight: 700; letter-spacing: 0.02em;
    text-transform: uppercase; font-size: 1rem; color: #fff; padding-right: 2rem;
}
.modal-content .modal-title span:last-child { color: var(--on-surface-variant); font-weight: 400; font-size: 0.8rem; }
.modal-content .close { background: transparent; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.modal-content .card-body p { font-size: 0.85rem; color: var(--on-surface-variant); }
.modal-content .card-body p span { color: var(--yellow); font-weight: 600; }

/* Style Bootstrap's .btn used inside modals as terminal buttons */
.btn.btn-primary, .btn.btn-secondary {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: var(--radius);
    border: 1px solid var(--yellow);
    background: var(--yellow);
    color: var(--on-yellow);
    padding: 0.6rem 0.9rem;
    transition: filter 0.15s;
}
.btn.btn-primary:hover, .btn.btn-secondary:hover { filter: brightness(1.1); color: var(--on-yellow); }
.modal-content .card-body .btn { display: block; width: 100%; }
.w-100 { width: 100%; }
.my-1 { margin-top: 0.4rem; margin-bottom: 0.4rem; }
.mb-5 { margin-bottom: 2rem; }

/* ---- full-detail modal (opened on card click) ---- */
.modal-dialog.detail-dialog { max-width: 640px; }
.modal-content.detail-modal {
    position: relative;
    background: var(--surface-low);
    color: var(--on-surface);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    /* gallery stays fixed at top; the body scrolls when content is tall */
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2rem);
}
.detail-modal .detail-gallery { flex-shrink: 0; }
.detail-modal .detail-body { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.detail-modal .detail-close {
    position: absolute; top: 0.6rem; right: 0.8rem; z-index: 2;
    width: 2rem; height: 2rem; border-radius: var(--radius);
    background: rgba(0,0,0,0.55); border: 1px solid var(--ghost-border);
    color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.detail-photo {
    height: 16rem; background: var(--surface-lowest); overflow: hidden;
    border-top-left-radius: var(--radius-lg); border-top-right-radius: var(--radius-lg);
    display: flex; align-items: center; justify-content: center; color: var(--outline);
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-photo.is-placeholder {
    flex-direction: column; gap: 0.5rem;
    background: radial-gradient(circle at 50% 35%, rgba(255,255,255,0.05), transparent 70%), var(--surface-lowest);
}
.detail-photo.is-placeholder i { font-size: 3rem; }
.detail-photo.is-placeholder .ph-label {
    font-family: var(--mono); font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-surface-variant);
}
.status-registered .detail-photo.is-placeholder i { color: var(--yellow); }
.status-buyer .detail-photo.is-placeholder i      { color: #d0bcff; }
.status-new .detail-photo.is-placeholder i        { color: var(--green); }
.status-coming .detail-photo.is-placeholder i     { color: var(--cyan); }
.detail-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.detail-status {
    font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 0.4rem; width: fit-content;
}
.detail-status::before {
    content: ""; width: 0.5rem; height: 0.5rem; border-radius: 9999px;
    background: currentColor; box-shadow: 0 0 6px currentColor;
}
.status-new .detail-status      { color: var(--green); }
.status-coming .detail-status   { color: var(--cyan); }
.status-registered .detail-status { color: var(--yellow); }
.status-buyer .detail-status    { color: #d0bcff; }
.detail-price { font-family: var(--mono); font-weight: 700; font-size: 1.8rem; color: #fff; font-variant-numeric: tabular-nums; }
.detail-specs { font-family: var(--mono); font-size: 0.8rem; color: var(--on-surface-variant); letter-spacing: 0.04em; }
.detail-address { font-family: var(--sans); font-weight: 600; font-size: 1.15rem; color: var(--on-surface); margin: 0.2rem 0 0; }
.detail-city { color: var(--on-surface-variant); }
.detail-agent { margin-top: 0.5rem; padding-top: 0.8rem; border-top: 1px solid var(--ghost-border-soft); }
.detail-agent .aname { color: #fff; font-weight: 600; }
.detail-agent .aoffice { color: var(--on-surface-variant); font-size: 0.85rem; }
.detail-contact { display: flex; gap: 0.4rem; margin-top: 0.7rem; flex-wrap: wrap; }
.detail-contact .mr-btn { flex: 1; min-width: 5rem; }
.detail-listing { margin-top: 0.5rem; }

/* ---- rich detail modal additions ---- */
.detail-gallery { position: relative; }
.gal-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 2.4rem; height: 2.4rem; border-radius: 9999px;
    background: rgba(0,0,0,0.55); border: 1px solid var(--ghost-border);
    color: #fff; font-size: 1.4rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.gal-nav:hover { background: rgba(0,0,0,0.8); border-color: var(--yellow); color: var(--yellow); }
.gal-prev { left: 0.6rem; } .gal-next { right: 0.6rem; }
.gal-counter {
    position: absolute; bottom: 0.6rem; right: 0.6rem;
    background: rgba(0,0,0,0.6); color: #fff; font-size: 0.65rem;
    padding: 0.15rem 0.5rem; border-radius: var(--radius);
}
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.detail-headright { display: inline-flex; align-items: center; gap: 0.9rem; }
.detail-mls { font-size: 0.7rem; color: var(--on-surface-variant); letter-spacing: 0.04em; }
.detail-stats .stat#detail-views { color: var(--on-surface-variant); }
.detail-stats .stat#detail-views b { color: var(--on-surface-variant); }
.detail-maptop {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--cyan); cursor: pointer;
}
/* headline quick stats (beds / baths / sqft / lot) */
.detail-stats {
    display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem;
    margin: 0.7rem 0 0; padding-top: 0.6rem; border-top: 1px solid var(--ghost-border-soft);
    font-family: var(--mono); font-size: 0.85rem; color: var(--on-surface-variant);
}
.detail-stats .stat b { color: #fff; font-weight: 700; font-size: 0.95rem; }
.detail-price-row { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.detail-drop {
    font-family: var(--mono); font-size: 0.7rem; font-weight: 700;
    color: var(--green); background: rgba(0,230,57,0.12);
    padding: 0.15rem 0.45rem; border-radius: var(--radius);
}
.detail-vitals {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1.25rem;
    margin: 1rem 0 0.25rem;
}
.vital {
    display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem;
    padding: 0.4rem 0; border-bottom: 1px solid var(--ghost-border-soft);
}
.vital .vlabel { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-surface-variant); }
.vital .vval { font-family: var(--mono); font-size: 0.82rem; color: var(--on-surface); text-align: right; }
.detail-section { margin-top: 1rem; }
.detail-h4 { font-family: var(--mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-surface-variant); margin: 0 0 0.4rem; }
.detail-desc { font-size: 0.88rem; line-height: 1.6; color: var(--on-surface); margin: 0; }
.detail-mapbox {
    height: 14rem; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--ghost-border-soft); background: var(--surface-lowest);
}
.detail-mapbox iframe { width: 100%; height: 100%; border: 0; display: block; }
.detail-maplink {
    display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.5rem;
    font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--cyan);
}
.detail-agents { margin-top: 1.25rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.detail-agent-card {
    border: 1px solid var(--ghost-border-soft); border-radius: var(--radius);
    padding: 0.75rem; background: var(--surface);
}
.detail-agent-card .agent-label {
    font-family: var(--mono); font-size: 0.58rem; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--on-surface-variant); margin-bottom: 0.35rem;
}
.detail-agent-card .aname { color: #fff; font-weight: 600; font-size: 0.95rem; }
.detail-agent-card .aoffice { color: var(--on-surface-variant); font-size: 0.78rem; margin-bottom: 0.4rem; }
.detail-agent-card .detail-contact { margin-top: 0.5rem; gap: 0.3rem; }
.detail-agent-card .detail-contact .mr-btn { font-size: 0.62rem; padding: 0.4rem 0.3rem; min-width: 0; }
.detail-loading { font-family: var(--mono); font-size: 0.72rem; color: var(--on-surface-variant); padding: 0.75rem 0; }
@media (max-width: 540px) {
    .detail-vitals, .detail-agents { grid-template-columns: 1fr; }
}

/* ---- New Buyer Want form ---- */
.bw-form { display: flex; flex-direction: column; gap: 0.5rem; padding-bottom: 1rem; }
.bw-label {
    font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--on-surface-variant); margin: 0.35rem 0 0;
}
.bw-input {
    width: 100%; background: var(--surface-lowest); color: var(--on-surface);
    border: 1px solid var(--ghost-border); border-radius: var(--radius);
    padding: 0.5rem 0.6rem; font-family: var(--sans); font-size: 0.85rem;
}
.bw-input:focus { outline: none; border-color: var(--yellow); }
textarea.bw-input { resize: vertical; }
.bw-row { display: flex; gap: 0.6rem; }
.bw-col { flex: 1 1 0; min-width: 0; }
.bw-hint, .bw-msg { font-size: 0.72rem; margin: 0.15rem 0 0; }
.bw-hint { color: var(--on-surface-variant); }
.bw-msg.is-error { color: var(--red); }
.bw-msg.is-ok { color: var(--green); }
.bw-toggle { display: flex; gap: 1rem; font-size: 0.85rem; color: var(--on-surface); padding: 0.15rem 0; }
.bw-toggle label { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; margin: 0; }
.bw-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.bw-chips:empty { display: none; }
.bw-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--surface-high); color: var(--on-surface);
    border: 1px solid var(--ghost-border); border-radius: 9999px;
    padding: 0.2rem 0.55rem; font-size: 0.78rem;
}
.bw-chip-x { background: none; border: none; color: var(--on-surface-variant); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0; }
.bw-chip-x:hover { color: var(--red); }
#bw-submit { margin-top: 0.6rem; }
/* The Google Places dropdown renders at the document root, above the modal. */
.pac-container { z-index: 2000; }

/* ---- Cards / Map view tabs ---- */
.mr-view-tabs { display: inline-flex; gap: 0.35rem; margin-left: auto; }
.mr-listings-col.is-map-view .isogrid { display: none; }
.mr-listings-col.is-map-view #expand-all { display: none; }

.mr-map-wrap { position: relative; }
.mr-map {
    width: 100%;
    height: min(72vh, 780px);
    min-height: 420px;
    background: var(--surface-lowest);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-lg);
    z-index: 0; /* keep map panes under the sticky nav / modals */
}
.mr-map-note {
    margin: 0.5rem 0 0;
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--on-surface-variant);
}

/* Google Maps info window, re-skinned to the terminal palette. The map canvas
   itself is dark-styled in JS (MAP_DARK_STYLES in scripts.js). */
.mr-map .gm-style .gm-style-iw-c {
    background: var(--surface-container);
    color: var(--on-surface);
    border: 1px solid var(--ghost-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    /* Google pads asymmetrically (reserves right/bottom for its scroller), so
       kill its padding entirely and pad our own .mr-map-pop instead. */
    padding: 0 !important;
}
.mr-map .gm-style .gm-style-iw-d {
    overflow: hidden !important; /* Google inline-styles a scroll gutter */
    color: var(--on-surface);
}
.mr-map .gm-style .gm-style-iw-tc::after { background: var(--surface-container); }
/* collapse the empty header band and pin the close (x) into the top-right
   corner, out of the layout flow (it otherwise reserves a whole row) */
.mr-map .gm-style .gm-style-iw-ch { display: none; }
.mr-map .gm-style-iw button.gm-ui-hover-effect {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    width: 22px !important;
    height: 22px !important;
}
/* close ("x") button: Google renders a dark ::before glyph — invert it */
.mr-map .gm-style-iw button.gm-ui-hover-effect > span { background-color: var(--on-surface-variant); }

/* Popup mini-card, themed like the listing cards. */
.mr-map-pop {
    min-width: 190px; --status: var(--yellow); font-family: var(--sans);
    padding: 0.7rem 0.85rem;
}
.mr-map-pop.status-new        { --status: var(--green); }
.mr-map-pop.status-coming     { --status: var(--cyan); }
.mr-map-pop.status-registered { --status: var(--yellow); }
.mr-map-pop .pop-strip {
    display: flex; justify-content: space-between; gap: 0.75rem;
    font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase;
    margin-bottom: 0.35rem;
    padding-right: 1.5rem; /* clear the absolutely-positioned close (x) button */
}
.mr-map-pop .pop-status { color: var(--status); font-weight: 700; }
.mr-map-pop .pop-type { color: var(--on-surface-variant); }
.mr-map-pop .pop-price { font-family: var(--mono); font-weight: 700; font-size: 1.05rem; color: #fff; }
.mr-map-pop .pop-specs { font-family: var(--mono); font-size: 0.7rem; color: var(--on-surface-variant); margin-top: 0.1rem; }
.mr-map-pop .pop-address { font-size: 0.85rem; margin-top: 0.3rem; }
.mr-map-pop .pop-city { font-size: 0.75rem; color: var(--on-surface-variant); }
.mr-map-pop .pop-details { margin-top: 0.55rem; width: 100%; }

@media (max-width: 767px) {
    .mr-view-tabs { margin-left: 0; }
    .mr-map { height: 62vh; min-height: 340px; }
}

/* ---- Open House mode ---------------------------------------------------- */

/* Header New Listings / Upcoming Open Houses toggle. */
.mr-mode-toggle {
    display: flex;
    gap: 0.25rem;
    padding: 0.2rem;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.15);
}
.mr-mode {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0a1422;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.mr-mode:hover { background: rgba(0, 0, 0, 0.09); }
.mr-mode.is-active {
    background: #0a1422;
    color: #fff;
}

/* Blue accent, matching the map pin color (PIN_COLORS status-openhouse). */
.prop-card.status-openhouse { --status: var(--oh-blue); }
.status-openhouse .card-status { color: var(--oh-blue); }
.status-openhouse .card-photo.placeholder i { color: var(--oh-blue); }
.status-openhouse .detail-photo.is-placeholder i { color: var(--oh-blue); }
.status-openhouse .detail-status { color: var(--oh-blue); }
.mr-map-pop.status-openhouse { --status: var(--oh-blue); }

/* Open-house timing line on the card. */
.card-when {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--oh-blue);
    margin-bottom: 0.2rem;
}

/* Upcoming-open-houses box in the detail modal (shown in any mode). */
.detail-oh .detail-h4 i { color: var(--oh-blue); }
.detail-oh-list {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.detail-oh-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-left: 3px solid var(--oh-blue);
    background: rgba(47, 128, 255, 0.10);
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.detail-oh-item i { color: var(--oh-blue); line-height: 1.5; }
.detail-oh-body { display: flex; flex-direction: column; gap: 0.1rem; }
.detail-oh-host {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--on-surface-variant);
}

/* Full-width date divider in the open-house grid (an Isotope item). */
.oh-divider { width: 100%; margin: 0.5rem 0 0.15rem; }
.oh-divider:first-child { margin-top: 0; }
.oh-divider-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.15rem;
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
.oh-divider-inner i { color: var(--oh-blue); }

@media (max-width: 767px) {
    /* Pull the toggle out of the header and float it at the bottom of the screen. */
    .mr-mode-toggle {
        position: fixed;
        left: 50%;
        transform: translateX(-50%);
        bottom: 0.85rem;
        z-index: 1030; /* above content + header, below the modal backdrop (1040) */
        background: #d9dee6; /* solid so it reads over the dark page */
        border-color: rgba(0, 0, 0, 0.25);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    }
    /* Leave room so the floating toggle never covers the footer. */
    .mr-footer { padding-bottom: 4.5rem; }
}
