/* ============================================================
   HOME PAGE — public/css/pages/home.css
   (loaded after style.css via @push('styles'))
   ============================================================ */

/* ── Shared page primitives ────────────────────────────────── */
[data-stat] { display: inline-block; min-width: 3ch; }
.eyebrow {
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--emerald-light); margin-bottom: 10px;
}
.section-head { max-width: 640px; margin-bottom: 44px; }
.section-head .eyebrow { color: var(--emerald); }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); color: var(--ink); line-height: 1.2; margin: 0 0 10px; }
.section-head h2 em { font-style: italic; color: var(--emerald); }
.section-head p { color: var(--ink-muted); font-size: 0.95rem; margin: 0; }

.pc-section { padding: 30px 0; }
@media (max-width: 575px) {
    .pc-section { padding: 44px 0; }
    .container { padding-left: 16px !important; padding-right: 16px !important; }
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 14% 18%, rgba(16,185,129,0.18), transparent 42%),
                linear-gradient(160deg, var(--navy-deep) 0%, var(--navy) 70%);
    padding: 64px 0 110px;
}
.hero::after {
    content: '';
    position: absolute; inset: 0;
    background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
                      linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent 75%);
}
.hero-bg-video {
    position: absolute; top: 50%; left: 50%;
    min-width: 100%; min-height: 100%;
    width: auto; height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}
.hero-bg-overlay {
    position: absolute; inset: 0; z-index: 1;
    /* navy wash so hero text stays readable over the footage */
    background: linear-gradient(180deg, rgba(15,35,66,0.82) 0%, rgba(15,35,66,0.72) 45%, rgba(15,35,66,0.90) 100%);
}
.hero-inner {
    position: relative; z-index: 2;
    display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; align-items: center;
}
.hero-copy h1 {
    color: #fff; font-size: clamp(2.1rem, 4.4vw, 3.4rem); line-height: 1.12; margin: 0 0 18px;
}
.hero-copy p.hero-sub {
    color: rgba(255,255,255,0.62); font-size: 1rem; line-height: 1.75; max-width: 480px; margin: 0;
}
.hero-copy p.hero-sub strong { color: #fff; }

.rotating-text {
    display: inline-block;
    color: var(--emerald-light);
    font-style: italic;
    font-family: var(--font-display);
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.rotating-text.rotate-out { transform: translateY(-20px); opacity: 0; }
.rotating-text.rotate-in  { transform: translateY(20px);  opacity: 0; }

.hero-ticker {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 18px; padding: 24px;
    backdrop-filter: blur(6px);
}
.ticker-head {
    display: flex; align-items: center; gap: 8px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    color: rgba(255,255,255,0.55); margin-bottom: 18px;
}
/* base box was missing, so the dot had zero size */
.live-dot {
    position: relative; display: inline-block; flex-shrink: 0;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--emerald-light);
}
.live-dot::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: var(--emerald-light);
    animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
    0%   { transform: scale(1);   opacity: .55; }
    70%, 100% { transform: scale(2.4); opacity: 0; }
}
.ticker-row { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.ticker-row:last-of-type { border-bottom: none; }
.ticker-num { font-family: var(--font-mono); font-size: 1.7rem; font-weight: 600; color: #fff; }
.ticker-label { font-size: 0.78rem; color: rgba(255,255,255,0.5); }
.ticker-split { display: flex; gap: 18px; padding-top: 14px; }
.ticker-split > div { flex: 1; }
.ticker-num.small { font-size: 1.15rem; display: block; }
.ticker-split .ticker-label { display: block; margin-top: 2px; }

@media (max-width: 991px) {
    .hero-inner { grid-template-columns: 1fr; }
    .hero { padding: 44px 0 130px; }
}

/* ── Filter bar (overlaps the hero bottom edge) ────────────── */
.filter-bar-wrap { position: relative; z-index: 2; margin-top: -64px; }
.filter-bar {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: 0 24px 48px -16px rgba(8,18,34,0.35);
    padding: 18px 22px;
    display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
}
.filter-field { flex: 1 1 0; min-width: 0; }
.filter-field label {
    display: block; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--ink-muted); margin-bottom: 6px;
}
.filter-field .form-select {
    border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: 0.88rem;
    color: var(--ink); background-color: var(--paper);
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.filter-field .form-select:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px var(--emerald-soft); }
.filter-bar .form-select:hover {
    background-color: var(--navy) !important;
    color: #fff !important;
    border-color: var(--navy) !important;
}

.btn-search {
    flex: 0 0 auto;
    background: var(--emerald); color: #fff; border: none; border-radius: 10px;
    padding: 11px 26px; font-weight: 700; font-size: 0.9rem;
    display: inline-flex; align-items: center; gap: 8px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.btn-search:hover { background-color: var(--navy); color: #fff; transform: translateY(-1px); }

@media (max-width: 991px) {
    .filter-bar-wrap { margin-top: -40px; }
    .filter-bar { flex-direction: column; align-items: stretch; border-radius: 16px; padding: 16px; }
    .filter-field { flex: 1 1 100%; }
    .btn-search { width: 100%; justify-content: center; padding: 12px 0; }
}

/* Address search + suggestions */
.filter-field-search { position: relative; }
.search-wrap { position: relative; }
.search-suggest {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 300px;
    background: #fff; border: 1px solid #E2E8F0; border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15,35,66,0.18); z-index: 2000;
    max-height: 340px; overflow-y: auto;
}
.ss-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #F1F5F9; }
.ss-item:last-child { border-bottom: 0; }
.ss-item:hover, .ss-item.active { background: #F0FDF4; }
.ss-main { font-weight: 700; font-size: 0.88rem; color: #0F2342; }
.ss-sub  { font-size: 0.75rem; color: #64748B; margin-top: 2px; }
.ss-badge { display: inline-block; font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; margin-left: 6px; }
.ss-badge.sold   { background: #FEE2E2; color: #B5271A; }
.ss-badge.listed { background: #D1FAE5; color: #047857; }
.ss-badge.none   { background: #E2E8F0; color: #475569; }
.ss-empty { padding: 12px 14px; font-size: 0.82rem; color: #64748B; }

/* ── Map ───────────────────────────────────────────────────── */
.map-card {
    background: var(--surface); border-radius: 20px; padding: 28px;
    box-shadow: 0 1px 3px rgba(15,23,42,0.06);
    border: 1px solid var(--line);
}
.map-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.map-card-head h2 { font-size: 1.5rem; margin: 2px 0 0; }
.map-card-head h2 span#map-listing-count { color: var(--emerald); font-family: var(--font-mono); }
.pill-for-sale {
    background: var(--emerald-soft); color: var(--emerald); font-weight: 700; font-size: 0.74rem;
    letter-spacing: 0.05em; text-transform: uppercase; padding: 6px 14px; border-radius: 999px;
    flex-shrink: 0;
}
.map-wrapper { position: relative; border-radius: 14px; overflow: hidden; }
#map {
    height: 500px;
    width: 100%;
    touch-action: none; /* let Leaflet fully own pinch/pan gestures on mobile */
}
#map-loading-overlay {
    display: none; position: absolute; inset: 0; z-index: 1000;
    background: rgba(247,248,250,0.88); backdrop-filter: blur(4px);
    flex-direction: column; align-items: center; justify-content: center;
}

@media (max-width: 768px) {
    .map-card { padding: 12px; border-radius: 16px; }
    .map-wrapper { border-radius: 10px; }
    #map { height: min(70vh, 560px); min-height: 400px; }
}
@media (max-width: 575px) {
    #map { height: min(65vh, 500px); min-height: 380px; }
    .marker-cluster div { min-width: 34px !important; min-height: 34px !important; }
}

/* ── Quick links ───────────────────────────────────────────── */
.quick-links-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.quick-link-card {
    display: flex; align-items: center; gap: 18px;
    background: #fff; border-radius: 20px; padding: 26px 28px;
    box-shadow: 0 10px 40px rgba(15,35,66,0.08); border: 1px solid #EEF2F6;
    text-decoration: none; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.quick-link-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(15,35,66,0.12); }
.qlc-icon {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #fff;
}
.qlc-value .qlc-icon { background: linear-gradient(135deg, #34D399, #059669); }
.qlc-sold .qlc-icon  { background: linear-gradient(135deg, #F87171, #B91C1C); }
.qlc-text { flex: 1; min-width: 0; }
.qlc-text h4 { margin: 0 0 4px; font-weight: 800; font-size: 1.05rem; color: #0F2342; }
.qlc-text p { margin: 0; font-size: 0.84rem; color: #64748B; line-height: 1.4; }
.qlc-arrow { color: #CBD5E1; font-size: 0.9rem; flex-shrink: 0; transition: transform 0.15s ease, color 0.15s ease; }
.quick-link-card:hover .qlc-arrow { color: #059669; transform: translateX(4px); }

@media (max-width: 768px) {
    .quick-links-grid { grid-template-columns: 1fr; }
    .quick-link-card { padding: 20px; }
}

/* ── KPI stats ─────────────────────────────────────────────── */
.stats-section { background: var(--paper); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.glass-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    padding: 24px 20px; text-align: center; cursor: pointer; height: 100%;
    box-shadow: var(--card-shadow);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.glass-card:hover { transform: translateY(-6px); box-shadow: 0 8px 24px rgba(15,23,42,0.06); }
.glass-card.active-gold {
    border-color: var(--emerald);
    border-top: 3px solid #1a3660;
    box-shadow: 0 8px 24px rgba(5,150,105,0.12);
}
.active-gold .stat-number { color: #1a3660; }
.stat-number {
    font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; color: var(--navy);
    line-height: 1; margin-bottom: 8px;
}
.stat-label {
    font-size: 0.8rem; font-weight: 600; color: var(--ink); margin-top: 8px;
    letter-spacing: 0.1em; text-transform: uppercase;
}
.stat-sub {
    font-size: 0.72rem; color: var(--ink-faint); margin-top: 3px;
    padding-top: 10px; border-top: 1px solid var(--mist);
}

@media (max-width: 575px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-number { font-size: 1.5rem; }
}

/* ── AI engine + house types ───────────────────────────────── */
.engine-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: stretch; }
.engine-panel {
    background: linear-gradient(165deg, var(--navy-deep), var(--navy-mid));
    border-radius: 20px; padding: 36px; color: #fff;
}
.engine-panel .panel-icon {
    width: 44px; height: 44px; background: rgba(16,185,129,0.18); border-radius: 10px;
    display: flex; align-items: center; justify-content: center; margin-bottom: 18px;
}
.engine-panel .panel-icon i { color: var(--emerald-light); }
.engine-panel h3 { font-size: 1.5rem; margin: 0 0 14px; }
.engine-panel p { color: rgba(255,255,255,0.62); font-size: 0.9rem; line-height: 1.75; margin-bottom: 26px; }
.engine-panel p strong { color: #fff; }

.ai-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-stat-mini {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px; padding: 16px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.ai-stat-mini .num { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; color: #fff; }
.ai-stat-mini .label { font-size: 0.72rem; color: rgba(255,255,255,0.5); font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; margin-top: 4px; }

.housetype-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 30px; }
.housetype-panel .eyebrow { color: var(--emerald); }
.housetype-panel h4 { font-size: 1.3rem; margin-bottom: 4px; }
.housetype-panel .lede { color: var(--ink-muted); font-size: 0.82rem; margin-bottom: 18px; }

.house-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.house-type-grid > * { min-width: 0; } /* prevent overflow */
.house-type-grid > *:last-child:nth-child(odd) { grid-column: 1 / -1; } /* lone last item goes full width */
.house-type-btn {
    background: var(--paper); border: 1px solid var(--mist); border-radius: 10px;
    padding: 16px; text-align: center; cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.house-type-btn .num { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--navy); }
.house-type-btn .label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); margin-top: 4px; }
.house-type-btn:hover { border-color: #1a3660; transform: translateY(-2px); }

.total-housing-box { margin-top: 18px; padding: 16px; text-align: center; background: var(--emerald-soft); border-radius: 12px; }
.total-housing-box .num { font-family: var(--font-mono); font-size: 1.9rem; font-weight: 700; color: var(--navy); }
.total-housing-box .label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--emerald); margin-top: 2px; }

/* navy hover for the stat tiles */
.house-type-btn:hover,
.ai-stat-mini:hover,
.mini-stat-box:hover {
    background-color: #0F2342 !important;
    color: #fff !important;
}
.house-type-btn:hover .num, .house-type-btn:hover .label,
.ai-stat-mini:hover .num,   .ai-stat-mini:hover .label,
.mini-stat-box:hover .num,  .mini-stat-box:hover .label {
    color: #fff !important;
}

@media (max-width: 991px) {
    .engine-grid { grid-template-columns: 1fr; }
    .engine-panel, .housetype-panel { padding: 24px; }
}

/* ── Charts dashboard ──────────────────────────────────────── */
.charts-section { background: var(--emerald-soft); }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.charts-grid .col-full { grid-column: 1 / -1; }
.chart-card {
    background: var(--surface); border-radius: 18px; padding: 24px; border: 1px solid var(--line);
    box-shadow: var(--card-shadow); height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chart-card:hover { transform: translateY(-4px); box-shadow: var(--card-shadow-hover); }
.chart-card .eyebrow { font-size: 0.66rem; margin-bottom: 6px; }
.chart-card h5 { font-size: 1.05rem; margin: 0 0 4px; color: var(--ink); font-family: var(--font-body); font-weight: 700; }
.chart-card .helper-text { color: var(--ink-muted); font-size: 0.82rem; margin-bottom: 14px; }
.total-label { font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700; color: var(--navy); }

.mini-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.mini-stat-box {
    background: var(--paper); border-radius: 10px; padding: 12px; text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.mini-stat-box .num { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.mini-stat-box .label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-faint); }
@media (min-width: 768px) {
    .mini-stat-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chart-card { padding: 18px; }
    #chartPredctiveHouseWithSingleAndMutipleAgent, #chartHouseTypes { height: 260px !important; }
    #chartListingCountByHouseType { height: 200px !important; }
}
@media (max-width: 575px) {
    #chartLandedMonthlysale, #chartLandedMonthlyrent { height: 220px !important; overflow: hidden; }
}

/* ── Total landed ML value ─────────────────────────────────── */
.ml-value-card {
    background: #fff;
    border: 1px solid var(--line, #E2E8F0);
    border-radius: 16px;
    padding: 36px 40px;
}
.ml-value-title {
    text-align: center; font-size: 1.6rem; font-weight: 800; color: #0F172A;
    margin: 8px 0 28px; line-height: 1.3;
}
.ml-value-highlight { color: #0d6efd; }

.realtime-update-bar {
    background: #DBEAFE;
    padding: 12px 40px;
    margin: -36px -40px 28px -40px; /* cancels card padding, sits flush at the top */
    border-radius: 16px 16px 0 0;
    overflow: hidden;
    display: flex; align-items: center;
}
.realtime-label { color: #DC2626; font-weight: 800; font-size: 0.85rem; margin-right: 10px; white-space: nowrap; flex-shrink: 0; }

/* CSS marquee (replaces the deprecated <marquee>) */
.realtime-marq { color: #1E293B; font-size: 0.9rem; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.realtime-track {
    display: inline-block; padding-left: 100%;
    animation: realtimeScroll 40s linear infinite;
    will-change: transform;
}
.realtime-marq:hover .realtime-track { animation-play-state: paused; }
@keyframes realtimeScroll { to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) {
    .realtime-marq { white-space: normal; }
    .realtime-track { animation: none; padding-left: 0; }
}

/* House-type value bar chart */
.mlv-chart-wrap { padding: 30px 10px 0; }
.mlv-chart {
    position: relative;
    display: flex; align-items: flex-end; justify-content: center;
    gap: 24px;
    height: 360px;
    padding: 0 10px 46px;
    border-bottom: 2px solid #E2E8F0;
}
.mlv-gridline { position: absolute; left: 0; right: 0; border-top: 1px dashed #E2E8F0; }
.mlv-gridline span { position: absolute; left: 0; top: -18px; font-size: 0.7rem; font-weight: 600; }
.mlv-bar-col { position: relative; display: flex; flex-direction: column; align-items: center; width: 120px; }
.mlv-bar-img {
    width: 100%;
    height: var(--bar-height, 100px); /* overridden by inline style */
    background-size: cover; background-position: center;
    border-radius: 12px 12px 4px 4px;
    box-shadow: 0 8px 20px rgba(15,35,66,0.2);
    transition: transform 0.2s ease;
}
.mlv-bar-col:hover .mlv-bar-img { transform: translateY(-5px); }
.mlv-bar-value { font-weight: 800; font-size: 0.95rem; color: #0F2342; margin-bottom: 8px; white-space: nowrap; }
.mlv-bar-label { margin-top: 12px; font-weight: 700; font-size: 0.85rem; color: #1E293B; text-align: center; }
.mlv-bar-sub { font-size: 0.72rem; text-align: center; }

@media (max-width: 767px) {
    .mlv-chart-wrap { padding: 8px 0 0; }
    .mlv-chart {
        flex-direction: column; align-items: stretch; justify-content: flex-start;
        gap: 14px; height: auto; padding: 0; border-bottom: 0;
    }
    .mlv-gridline { display: none; }
    .mlv-bar-col {
        width: 100%;
        display: grid;
        grid-template-columns: 64px 1fr auto;
        grid-template-areas:
            "img label value"
            "img sub   value"
            "img bar   bar";
        column-gap: 12px; row-gap: 2px; align-items: center;
    }
    .mlv-bar-img { grid-area: img; width: 64px; height: 64px !important; border-radius: 10px; }
    .mlv-bar-label { grid-area: label; margin: 0; text-align: left; }
    .mlv-bar-sub   { grid-area: sub;   text-align: left; }
    .mlv-bar-value { grid-area: value; margin: 0; }
    .mlv-bar-col::after {
        content: ''; grid-area: bar;
        height: 8px; width: var(--pct); margin-top: 6px;
        border-radius: 99px;
        background: linear-gradient(90deg, #34D399, #059669);
    }
}
@media (max-width: 575px) {
    .ml-value-card { padding: 24px 20px; }
    .realtime-update-bar { margin: -24px -20px 20px -20px; padding: 10px 20px; border-radius: 12px 12px 0 0; }
}

/* ── Key transaction insights ──────────────────────────────── */
.transaction-insights-card {
    background: #fff;
    border: 1px solid var(--line, #E2E8F0);
    border-radius: 16px;
    padding: 36px 40px;
}
.ti-title { text-align: center; font-size: 1.7rem; font-weight: 800; color: #0F172A; margin-bottom: 24px; }
.ti-body { display: flex; align-items: center; gap: 40px; }
.ti-copy { flex: 1.6; }
.ti-copy p { font-size: 0.95rem; line-height: 1.7; margin-bottom: 28px; }
.ti-stat-row { display: flex; gap: 32px; }
.ti-stat { flex: 1; }
.ti-num { font-size: 2.2rem; font-weight: 800; color: #0d6efd; line-height: 1.1; margin-bottom: 6px; }
.ti-label { font-size: 0.8rem; font-weight: 600; color: #64748B; }
.ti-label span { font-weight: 500; color: #94A3B8; }
.ti-image { flex: 1; border: 1px solid var(--line, #E2E8F0); border-radius: 12px; overflow: hidden; }
.ti-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 767px) {
    .ti-body { flex-direction: column; }
    .ti-stat-row { flex-direction: column; gap: 20px; }
}

/* ── Surf AI chat widget ───────────────────────────────────── */
.surf-chat-btn {
    position: fixed; bottom: 28px; right: 28px; z-index: 9999;
    width: 58px; height: 58px; border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald), var(--emerald-light));
    border: none; cursor: pointer;
    box-shadow: 0 4px 20px rgba(5,150,105,0.35);
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.surf-chat-btn:hover { transform: scale(1.07); }
.surf-chat-btn::after {
    content: ''; position: absolute; width: 58px; height: 58px; border-radius: 50%;
    border: 2px solid rgba(16,185,129,0.45); animation: surfPulse 2s infinite;
}
@keyframes surfPulse { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.6); opacity: 0; } }

.surf-chat-window {
    position: fixed; bottom: 98px; right: 28px; z-index: 9998;
    width: 350px; max-height: 520px;
    background: var(--surface); border-radius: 18px;
    box-shadow: 0 8px 40px rgba(8,18,34,0.22);
    display: none; flex-direction: column; overflow: hidden;
    animation: slideUpChat 0.25s ease;
}
@keyframes slideUpChat { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.surf-chat-window.open { display: flex; }
.surf-chat-header {
    background: linear-gradient(135deg, var(--navy-deep), var(--navy-mid));
    color: #fff; padding: 16px 20px; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.surf-chat-header-avatar { width: 38px; height: 38px; border-radius: 50%; background: rgba(16,185,129,0.2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.surf-chat-header-info .name { font-weight: 700; font-size: 0.92rem; }
.surf-chat-header-info .status { font-size: 0.72rem; color: rgba(255,255,255,0.55); display: flex; align-items: center; gap: 5px; }
.surf-chat-header-info .status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-light); display: inline-block; }
.surf-chat-close { margin-left: auto; background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; font-size: 1.2rem; padding: 0; }
.surf-chat-close:hover { color: #fff; }
.surf-chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--paper); }
.chat-bubble { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 0.85rem; line-height: 1.55; }
.chat-bubble.bot { background: var(--surface); color: var(--ink); border-bottom-left-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.07); align-self: flex-start; }
.chat-bubble.user { background: linear-gradient(135deg, var(--emerald), var(--emerald-light)); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.chat-bubble.bot .bot-label { font-size: 0.68rem; font-weight: 700; color: var(--emerald); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; }
.surf-chat-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; background: var(--paper); }
.surf-suggestion-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px; font-size: 0.75rem; cursor: pointer; color: var(--navy); font-weight: 600; transition: all 0.15s; white-space: nowrap; }
.surf-suggestion-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.surf-chat-input-row { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--surface); flex-shrink: 0; }
.surf-chat-input { flex: 1; border: 1px solid var(--line); border-radius: 20px; padding: 8px 14px; font-size: 0.84rem; outline: none; background: var(--paper); color: var(--ink); }
.surf-chat-input:focus { border-color: var(--emerald); }
.surf-send-btn { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--emerald), var(--emerald-light)); border: none; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform 0.15s; }
.surf-send-btn:hover { transform: scale(1.1); }

@media (max-width: 575px) {
    .surf-chat-window { width: calc(100vw - 24px); right: 12px; bottom: 88px; }
    .surf-chat-btn { bottom: 18px; right: 18px; }
}

/* ── District / house-type modal ───────────────────────────── */
#houseTypeModal { display: none; position: fixed; inset: 0; z-index: 99999; background: rgba(8,18,34,0.55); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.modal-card { background: var(--surface); border-radius: 20px; width: 90%; max-width: 420px; box-shadow: 0 20px 60px rgba(8,18,34,0.3); overflow: hidden; animation: modalPop 0.22s cubic-bezier(.34,1.56,.64,1); }
@keyframes modalPop { from { opacity: 0; transform: scale(0.88) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-head { background: linear-gradient(135deg, var(--navy-deep), var(--navy-mid)); padding: 20px 24px; position: relative; }
.modal-head .eyebrow { color: var(--emerald-light); margin-bottom: 6px; }
.modal-head h4 { color: #fff; margin: 0; font-size: 1.3rem; font-weight: 700; font-family: var(--font-body); }
.modal-head p { color: rgba(255,255,255,0.5); font-size: 0.82rem; margin: 4px 0 0; }
.modal-close { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,0.1); border: none; border-radius: 50%; width: 30px; height: 30px; color: #fff; cursor: pointer; font-size: 1rem; display: flex; align-items: center; justify-content: center; }
.modal-body { padding: 20px 24px 8px; }
.modal-foot { padding: 12px 24px 20px; }
.modal-foot a { display: block; text-align: center; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, var(--emerald), var(--emerald-light)); color: #fff; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-decoration: none; }

/* Skip rendering work for below-the-fold sections */
.charts-section, .ml-value-section, .transaction-insights-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 800px;
}

/* OPTION 1 — sticky search filters bounded to the map section.
   The map retains its original 500px desktop height. */
.map-search-region { display: flow-root; position: relative; }
.map-search-region > .filter-bar-wrap {
    position: sticky;
    top: var(--map-sticky-top, 12px);
    z-index: 1100;
}
.map-search-region > .filter-bar-wrap .filter-bar {
    box-shadow: 0 12px 32px rgba(8,18,34,.18);
}
/* Prevent the sticky bar from obscuring map controls and avoid fixed heights. */
.map-search-region .map-card { scroll-margin-top: 120px; }
@media (max-width: 991px) {
    /* Stacked filters are taller than the map on tablets/phones. */
    .map-search-region > .filter-bar-wrap { position: relative; top: auto; }
}
