/* ── Theme-aware CSS variables for listing cards & detail modal ── */
:root {
  --nav-height: 4rem; /* height of the fixed mobile bottom navigation bar */
  --ld-card-bg: #ffffff;
  --ld-card-border: rgba(0,0,0,0.07);
  --ld-card-text-primary: #111827;
  --ld-card-text-muted: rgba(55,65,81,0.55);
  --ld-card-text-faint: rgba(55,65,81,0.38);
  --ld-card-chip-bg: rgba(0,0,0,0.04);
  --ld-card-chip-border: rgba(0,0,0,0.08);
  --ld-card-chip-color: #374151;
  --ld-card-btn-bg: rgba(0,0,0,0.04);
  --ld-card-btn-border: rgba(0,0,0,0.1);
  --ld-card-btn-color: #374151;
  --ld-left-panel-bg: #f9fafb;
  --ld-left-panel-border: rgba(0,0,0,0.06);
  --ld-right-panel-bg: #f4f6f8;
  --ld-section-border: rgba(0,0,0,0.06);
  --ld-text: #111827;
  --ld-text-muted1: rgba(55,65,81,0.55);
  --ld-text-muted2: rgba(55,65,81,0.42);
  --ld-text-faint: rgba(55,65,81,0.32);
  --ld-btn-bg: rgba(0,0,0,0.04);
  --ld-btn-border: rgba(0,0,0,0.1);
  --ld-btn-hover-bg: rgba(0,0,0,0.08);
  --ld-btn-disabled-bg: rgba(0,0,0,0.03);
  --ld-btn-disabled-border: rgba(0,0,0,0.06);
  --ld-btn-disabled-color: rgba(55,65,81,0.28);
  --ld-avatar-bg: linear-gradient(135deg,#e5e7eb,#d1d5db);
  --ld-avatar-border: rgba(0,0,0,0.1);
  --ld-avatar-text: #374151;
  --ld-thumb-strip-bg: #f3f4f6;
  --ld-thumb-border: rgba(0,0,0,0.12);
  --ld-chip-bg: rgba(0,0,0,0.04);
  --ld-chip-border: rgba(0,0,0,0.08);
  --ld-chip-color: #374151;
  --ld-map-overlay-bg: rgba(248,250,252,0.88);
  --ld-map-overlay-border: rgba(0,0,0,0.1);
  --ld-map-overlay-color: rgba(55,65,81,0.65);
  --ld-map-container-border: rgba(0,0,0,0.1);
  --ld-sim-card-bg: #f3f4f6;
  --ld-sim-card-border: rgba(0,0,0,0.08);
  --ld-section-label-color: rgba(55,65,81,0.4);
  --ld-infra-chip-bg: rgba(0,0,0,0.04);
  --ld-infra-chip-border: rgba(0,0,0,0.08);
  --ld-infra-chip-color: #374151;
  --ld-amenity-bg: rgba(0,0,0,0.03);
  --ld-amenity-border: rgba(0,0,0,0.07);
  --ld-amenity-color: #374151;
  --ld-amenity-label: rgba(55,65,81,0.32);
  --ld-header-bar-border: rgba(0,0,0,0.07);
  --ld-close-btn-bg: rgba(0,0,0,0.06);
  --ld-close-btn-border: rgba(0,0,0,0.1);
  --ld-scroll-thumb: rgba(0,0,0,0.15);
  --ld-icon-faint: rgba(55,65,81,0.4);
  --ld-cal-btn-color: #1d4ed8;
  --ld-metro-chip-color: #1d4ed8;
}

.dark {
  --ld-card-bg: #161f2e;
  --ld-card-border: rgba(255,255,255,0.07);
  --ld-card-text-primary: #ffffff;
  --ld-card-text-muted: rgba(255,255,255,0.45);
  --ld-card-text-faint: rgba(255,255,255,0.35);
  --ld-card-chip-bg: rgba(255,255,255,0.06);
  --ld-card-chip-border: rgba(255,255,255,0.09);
  --ld-card-chip-color: rgba(255,255,255,0.65);
  --ld-card-btn-bg: rgba(255,255,255,0.06);
  --ld-card-btn-border: rgba(255,255,255,0.1);
  --ld-card-btn-color: rgba(255,255,255,0.75);
  --ld-left-panel-bg: #121826;
  --ld-left-panel-border: rgba(255,255,255,0.06);
  --ld-right-panel-bg: #0d1117;
  --ld-section-border: rgba(255,255,255,0.05);
  --ld-text: #ffffff;
  --ld-text-muted1: rgba(255,255,255,0.45);
  --ld-text-muted2: rgba(255,255,255,0.4);
  --ld-text-faint: rgba(255,255,255,0.28);
  --ld-btn-bg: #1a2235;
  --ld-btn-border: rgba(255,255,255,0.1);
  --ld-btn-hover-bg: #223050;
  --ld-btn-disabled-bg: #141b28;
  --ld-btn-disabled-border: rgba(255,255,255,0.06);
  --ld-btn-disabled-color: rgba(255,255,255,0.25);
  --ld-avatar-bg: linear-gradient(135deg,#1e3a5f,#1e293b);
  --ld-avatar-border: rgba(255,255,255,0.1);
  --ld-avatar-text: #ffffff;
  --ld-thumb-strip-bg: #0d1120;
  --ld-thumb-border: rgba(255,255,255,0.1);
  --ld-chip-bg: rgba(255,255,255,0.05);
  --ld-chip-border: rgba(255,255,255,0.09);
  --ld-chip-color: rgba(255,255,255,0.7);
  --ld-map-overlay-bg: rgba(10,14,24,0.82);
  --ld-map-overlay-border: rgba(255,255,255,0.1);
  --ld-map-overlay-color: rgba(255,255,255,0.55);
  --ld-map-container-border: rgba(255,255,255,0.07);
  --ld-sim-card-bg: #151f30;
  --ld-sim-card-border: rgba(255,255,255,0.07);
  --ld-section-label-color: rgba(255,255,255,0.3);
  --ld-infra-chip-bg: rgba(255,255,255,0.05);
  --ld-infra-chip-border: rgba(255,255,255,0.09);
  --ld-infra-chip-color: rgba(255,255,255,0.6);
  --ld-amenity-bg: rgba(255,255,255,0.04);
  --ld-amenity-border: rgba(255,255,255,0.08);
  --ld-amenity-color: rgba(255,255,255,0.6);
  --ld-amenity-label: rgba(255,255,255,0.22);
  --ld-header-bar-border: rgba(255,255,255,0.06);
  --ld-close-btn-bg: rgba(255,255,255,0.07);
  --ld-close-btn-border: rgba(255,255,255,0.1);
  --ld-scroll-thumb: rgba(255,255,255,0.08);
  --ld-icon-faint: rgba(255,255,255,0.4);
  --ld-cal-btn-color: rgba(255,255,255,0.85);
  --ld-metro-chip-color: rgba(255,255,255,0.75);
}

body {
  font-family: 'Open Sauce', sans-serif;
}

.animate-fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sidebar-link {
  transition: all 0.2s ease-in-out;
}

.sidebar-link.active {
  background-color: #2563eb;
  color: white;
  cursor: pointer;
}

.sidebar-link:first-child:hover,
.sidebar-link:nth-child(2):hover {
  cursor: pointer;
}

.asset-card {
  transition: all 0.2s ease-in-out;
}

.asset-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.logout svg {
  stroke: rgb(107 114 128);
}

.login {
  transition: 0.3s;
}

.aside.mobile {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
}

.profile.mobile {
  position: absolute;
  bottom: 0;
  width: 100%;
}

/* ── Evaluate type cards (light + dark mode) ──────────── */
.eval-card-apt {
  background: rgba(219,234,254,0.85);
  border: 1.5px solid rgba(59,130,246,0.3);
}
.eval-card-apt .eval-icon {
  background: rgba(59,130,246,0.18);
}
.eval-card-apt:hover {
  background: rgba(219,234,254,1);
  border-color: rgba(59,130,246,0.6);
}
.eval-card-car {
  background: rgba(209,250,229,0.85);
  border: 1.5px solid rgba(16,185,129,0.3);
}
.eval-card-car .eval-icon {
  background: rgba(16,185,129,0.18);
}
.eval-card-car:hover {
  background: rgba(209,250,229,1);
  border-color: rgba(16,185,129,0.6);
}
.eval-card-rent {
  background: rgba(243,244,246,0.7);
  border: 1.5px solid rgba(209,213,219,0.8);
}
.eval-icon-disabled {
  background: rgba(156,163,175,0.15);
  display: flex; align-items: center; justify-content: center;
}
.eval-icon-disabled i { color: rgba(156,163,175,0.6); }
.dark .eval-card-apt {
  background: rgba(0,136,204,0.08);
  border: 1.5px solid rgba(0,136,204,0.18);
}
.dark .eval-card-apt .eval-icon {
  background: rgba(0,136,204,0.15);
}
.dark .eval-card-apt:hover {
  background: rgba(0,136,204,0.15);
  border-color: rgba(0,136,204,0.4);
}
.dark .eval-card-car {
  background: rgba(16,185,129,0.08);
  border: 1.5px solid rgba(16,185,129,0.18);
}
.dark .eval-card-car .eval-icon {
  background: rgba(16,185,129,0.15);
}
.dark .eval-card-car:hover {
  background: rgba(16,185,129,0.15);
  border-color: rgba(16,185,129,0.4);
}
.dark .eval-card-rent {
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.08);
}
.dark .eval-icon-disabled {
  background: rgba(255,255,255,0.06);
}
.dark .eval-icon-disabled i { color: rgba(255,255,255,0.25); }

/* ── Listing detail modal — light/dark adaptive ───────── */
.ld-modal-bg { background: #f9fafb; }
.dark .ld-modal-bg { background: #0f1117; }
.ld-modal-right { background: #f9fafb; }
.dark .ld-modal-right { background: #0f1117; }
.ld-text-primary { color: #111827; }
.dark .ld-text-primary { color: #fff; }
.ld-text-secondary { color: #374151; }
.dark .ld-text-secondary { color: #d1d5db; }
.ld-text-muted { color: #6b7280; }
.dark .ld-text-muted { color: #9ca3af; }
.ld-text-faint { color: #9ca3af; }
.dark .ld-text-faint { color: #4b5563; }
.ld-section-border { border-bottom: 1px solid rgba(0,0,0,0.06); }
.dark .ld-section-border { border-bottom: 1px solid rgba(255,255,255,0.05); }
.ld-chip { background: #f3f4f6; border: 1px solid #e5e7eb; }
.dark .ld-chip { background: #1f2937; border: 1px solid #374151; }
.ld-card { background: rgba(243,244,246,0.8); border: 1px solid #e5e7eb; }
.dark .ld-card { background: rgba(31,41,55,0.6); border: 1px solid #374151; }
.ld-avatar { background: #e5e7eb; }
.dark .ld-avatar { background: #374151; }
.ld-tag { background: #f3f4f6; border: 1px solid #e5e7eb; }
.dark .ld-tag { background: #1f2937; border: 1px solid #374151; }
.ld-map-border { border: 1px solid #d1d5db; }
.dark .ld-map-border { border: 1px solid #374151; }
.ld-contact-border { border-top: 1px solid rgba(0,0,0,0.08); }
.dark .ld-contact-border { border-top: 1px solid rgba(255,255,255,0.05); }
.ld-btn-secondary { background: rgba(0,0,0,0.04); border: 1px solid #d1d5db; color: #374151; }
.dark .ld-btn-secondary { background: rgba(255,255,255,0.04); border: 1px solid #4b5563; color: #d1d5db; }
.ld-btn-secondary:hover { border-color: #93c5fd; color: #2563eb; }
.dark .ld-btn-secondary:hover { border-color: #3b82f6; color: #fff; }
.ld-btn-share { background: rgba(99,102,241,0.06); border: 1px solid rgba(99,102,241,0.25); color: #6366f1; }
.dark .ld-btn-share { background: rgba(99,102,241,0.08); border: 1px solid rgba(99,102,241,0.4); color: #818cf8; }
.ld-btn-share:hover { background: rgba(99,102,241,0.12); border-color: #6366f1; }
.ld-similar-card { background: #f3f4f6; border: 1px solid #e5e7eb; }
.dark .ld-similar-card { background: linear-gradient(145deg,#1e2235,#161929); border: 1px solid rgba(99,102,241,0.15); }
.ld-similar-card:hover { border-color: #93c5fd; }
.dark .ld-similar-card:hover { border-color: rgba(99,102,241,0.55); box-shadow: 0 8px 32px rgba(99,102,241,0.2); }
.ld-sl-chip-blue { color: #1d4ed8; background: rgba(59,130,246,0.1); }
.dark .ld-sl-chip-blue { color: #93c5fd; background: rgba(59,130,246,0.12); }
.ld-sl-chip-purple { color: #7c3aed; background: rgba(139,92,246,0.1); }
.dark .ld-sl-chip-purple { color: #c4b5fd; background: rgba(139,92,246,0.12); }

/* Listing detail sheet — phone card, sizing handled by inline style */
#listing-detail-sheet { }

/* ── Marketplace listing cards ───────────────────────── */
.listing-card {
  will-change: transform, box-shadow;
}

.listing-card:hover {
  transform: translateY(-3px);
}

/* Carousel: ensure strip images fill aspect-ratio container */
.lci-wrap .lci-strip img {
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
}

.listing-card img {
  will-change: transform;
}

/* Smooth scroll for horizontal chip rows inside cards */
.listing-card [style*="scrollbar-width:none"],
#announcements-grid [style*="scrollbar-width"] {
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.listing-card [style*="scrollbar-width:none"]::-webkit-scrollbar {
  display: none;
}

/* ── MapLibre popup — dark theme so it's visible on light map ──── */
.maplibregl-popup-content {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 24px rgba(0,0,0,0.45) !important;
  padding: 8px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  max-width: 220px !important;
}
.maplibregl-popup-tip {
  border-top-color: #1e293b !important;
  border-bottom-color: #1e293b !important;
}
.maplibregl-popup-close-button {
  color: #94a3b8 !important;
  font-size: 16px !important;
  padding: 2px 6px !important;
}
.maplibregl-popup-close-button:hover { color: #f8fafc !important; }

/* Sidebar filter inputs focus glow */
#marketplace-sidebar input:focus {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

/* Sort select */
#marketplace-sort {
  cursor: pointer;
}

/* Staggered card shimmer on load */
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── View-transition loading overlay ─────────────────────────────── */
.view-loader {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--vl-bg, #f9fafb);
  animation: vl-fade-in 0.15s ease-out;
}
.dark .view-loader {
  --vl-bg: #111827;
}
.view-loader.vl-out {
  animation: vl-fade-out 0.3s ease-in forwards;
  pointer-events: none;
}
@keyframes vl-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes vl-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Pulsing ring spinner */
.vl-spinner {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(99,102,241,0.15);
  border-top-color: #6366f1;
  animation: vl-spin 0.7s linear infinite;
}
@keyframes vl-spin {
  to { transform: rotate(360deg); }
}

/* Skeleton shimmer bar */
.vl-skeleton {
  width: min(280px, 60%);
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(99,102,241,0.08) 25%,
    rgba(99,102,241,0.18) 50%,
    rgba(99,102,241,0.08) 75%);
  background-size: 200% 100%;
  animation: vl-shimmer 1.4s ease-in-out infinite;
}
@keyframes vl-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.vl-label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(148,163,184,0.8);
  letter-spacing: 0.03em;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin-slow {
    animation: spin-slow 3s linear infinite;
}

/* Класс для плавного исчезновения */
.loader-hidden {
    opacity: 0;
    pointer-events: none;
}

/* ── Professional preloader animations ──────────────────────────────── */
@keyframes pl-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes pl-ring-pulse {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50%       { opacity: 0.7; transform: scale(1.08); }
}
@keyframes pl-progress {
  0%   { width: 0%; background-position: 0% 50%; }
  60%  { width: 100%; background-position: 100% 50%; }
  100% { width: 100%; background-position: 200% 50%; }
}

@media print {
    /* Скрываем навигацию, кнопки и лишние элементы интерфейса */
    nav, footer, .download-btn, .no-print, .mt-8, aside, header { 
        display: none !important; 
    }

    body {
        background: white !important;
        -webkit-print-color-adjust: exact !important; /* Чтобы цвета и фоны сохранялись */
        print-color-adjust: exact !important;
    }

    main {
        padding-top: 0 !important; /* Убираем отступ от хедера */
    }

    /* ЗАПРЕТ РАЗРЫВА: Применяем к нашим блокам */
    .grid > div, 
    section, 
    .bg-white {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 10px;
    }

    /* Чтобы таблицы не резались */
    table {
        break-inside: auto;
    }
    tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    /* Снимаем тени, так как в PDF они могут выглядеть грязно */
    .shadow-xl, .shadow-sm, .shadow-2xl {
        box-shadow: none !important;
    }

    /* Adjust report preview padding for print */
    .pt-32 {
        padding-top: 1rem !important;
    }
    .pb-20 {
        padding-bottom: 1rem !important;
    }
}
/* ── Evaluate asset-type image cards ────────────────────────────── */
.evaluate-asset-type-btn { box-shadow: 0 4px 20px rgba(0,0,0,0.18); }
.evaluate-asset-type-btn:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.28); transform: translateY(-2px); }
.evaluate-asset-type-btn:active { transform: scale(0.97); }

/* ── Mobile-first evaluate card overrides (< 768px) ─────────────── */
@media (max-width: 767px) {
  .eval-card-apt {
    background: rgba(0,136,204,0.10);
    border: 1.5px solid rgba(0,136,204,0.25);
  }
  .eval-card-apt .eval-icon { background: rgba(0,163,224,0.18); }
  .eval-card-apt:active { background: rgba(0,136,204,0.18); }

  .eval-card-car {
    background: rgba(16,185,129,0.10);
    border: 1.5px solid rgba(16,185,129,0.25);
  }
  .eval-card-car .eval-icon { background: rgba(16,185,129,0.18); }
  .eval-card-car:active { background: rgba(16,185,129,0.18); }

  .eval-card-rent {
    background: rgba(255,255,255,0.04);
    border: 1.5px solid rgba(255,255,255,0.10);
  }
  .eval-icon-disabled { background: rgba(255,255,255,0.07); }
  .eval-icon-disabled i { color: rgba(255,255,255,0.28); }

  .evaluate-asset-type-btn:hover { transform: none; }
}

/* ── Map mobile sheet slide-in animation ────────────────────────── */
@keyframes map-sheet-slide-in {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ── Chat drawer panel ───────────────────────────────────────────── */
#chat-panel {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#chat-msg-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}
#chat-msg-view.hidden { display: none !important; }

/* ── AI FAB pulse stop on hover ──────────────────────────────────── */
#ai-fab:hover #ai-fab-pulse { animation: none; opacity: 0; }

/* ── AI Drawer panel ─────────────────────────────────────────────── */
#ai-drawer-panel {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, scale 0.3s ease;
}
@media (min-width: 768px) {
  #ai-drawer-panel.open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    scale: 1 !important;
  }
}

/* ── Mobile bottom nav ───────────────────────────────────────────── */
.mob-nav-btn { -webkit-tap-highlight-color: transparent; }
.mob-nav-btn.text-blue-500 i { color: #3b82f6; }
.mob-nav-btn.text-blue-500 span { color: #3b82f6; }
/* safe area for iOS home indicator */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* ── Map modal — full-screen on mobile ──────────────────────────── */
@media (max-width: 639px) {
  /* Make the centering wrapper stretch to fill the viewport */
  #map-modal-inner {
    align-items: stretch !important;
    padding: 0 !important;
  }
  /* Sheet fills the entire screen — no bottom-sheet ambiguity */
  #map-modal-sheet {
    max-height: 100dvh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
  }
  /* Map fills all remaining space between header and footer */
  #map-modal-map-wrap {
    flex: 1 1 0%;
    min-height: 0;
    padding: 8px 12px;
  }
  #map-modal-map-wrap #map {
    min-height: 100% !important;
    height: 100% !important;
  }
  /* Footer gets safe-area padding so buttons clear the home indicator */
  #map-modal-sheet > div:last-child {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
  }
}

/* ── GeoScore (embedded map service) ──────────────────────────────
   The map lives in its own service and is embedded in an iframe, so it
   cannot size itself to the shell — the wrapper owns the height. Desktop
   matches the listings map (100vh - 200px) so both views feel the same. */
#geoscore-frame-wrap {
  height: calc(100vh - 200px);
  min-height: 420px;
}
#geoscore-frame { height: 100%; }

/* ── Mobile layout fixes ─────────────────────────────────────────── */
@media (max-width: 767px) {
  /* ── Bottom-nav clearance: iOS Safari ignores padding-bottom on
     overflow:auto containers, so we use a real spacer element instead.
     The spacer is #mob-scroll-spacer (last child of #views-container).  ── */
  #views-container {
    /* Keep a small padding for non-iOS browsers as a fallback */
    padding-bottom: 0 !important;
  }
  /* Real DOM spacer — reliable on iOS Safari */
  #mob-scroll-spacer {
    height: calc(var(--nav-height) + 24px + env(safe-area-inset-bottom, 0px));
  }

  /* Evaluate form: "Add Photo" box and action button must clear the nav */
  #eval-photos-section {
    margin-bottom: 8px;
  }
  #eval-photos-section label {
    min-height: 48px;
  }
  #evaluate-view .flex.justify-center {
    padding-bottom: 8px;
  }

  /* Map container height must leave room for header + bottom nav + safe area */
  #map-view .flex-1.relative {
    height: calc(100dvh - var(--nav-height) - 3.5rem - env(safe-area-inset-bottom, 0px)) !important;
    min-height: 300px !important;
  }
  /* GeoScore: edge-to-edge under the header, above the bottom nav. The
     embedded map has its own controls, so the shell adds no chrome here —
     the desktop header block is hidden and the frame takes the full area. */
  #geoscore-view > div:first-child { display: none !important; }
  #geoscore-frame-wrap {
    height: calc(100dvh - var(--nav-height) - 3.5rem - env(safe-area-inset-bottom, 0px)) !important;
    min-height: 320px !important;
  }
  /* Listing cards: stack vertically on mobile */
  .listing-card { flex-direction: column !important; }
  .listing-card .lci-wrap { width: 100% !important; min-height: 180px !important; }

  /* Filter drawer slide-up — only flex when NOT hidden */
  #mobile-filter-drawer {
    position: fixed; inset: 0; z-index: 800;
    flex-direction: column; justify-content: flex-end;
  }
  #mobile-filter-drawer:not(.hidden) {
    display: flex;
  }
  #mobile-filter-drawer-panel {
    background: var(--tw-bg-white, #fff);
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px 16px 32px;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
  }
  .dark #mobile-filter-drawer-panel { background: #1f2937; }

  /* Views container: less padding on mobile */
  #views-container { padding: 0.75rem !important; }
  /* Map view needs zero padding — NO overflow:hidden (breaks MapLibre) */
  #views-container:has(#map-view:not(.hidden)) { padding: 0 !important; }

  /* Header: tighten on mobile */
  header h2#page-title { font-size: 1rem !important; }

  /* Dashboard asset cards: smaller on mobile */
  .asset-card { border-radius: 0.75rem !important; }

  /* Listing card image: shorter on mobile */
  .listing-card .lci-wrap img { object-fit: cover; }

  /* Listing card content: smaller padding on mobile */
  .listing-card > div:last-child { padding: 0.75rem !important; gap: 0.5rem !important; }

  /* Listing card price: smaller font on mobile */
  .listing-card .flex-shrink-0 p:first-child { font-size: 1rem !important; }

  /* Listing card action buttons: compact row, allow horizontal scroll */
  .listing-card .flex.gap-2 { gap: 0.375rem !important; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .listing-card .flex.gap-2::-webkit-scrollbar { display: none; }
  .listing-card .flex.gap-2 a,
  .listing-card .flex.gap-2 button { flex-shrink: 0; padding: 0.375rem 0.625rem !important; }

  /* Announcements sort bar: tighter */
  #marketplace-sort { font-size: 0.7rem !important; padding: 0.25rem 0.5rem !important; }

  /* Listings count label + sort: tighter on mobile */
  #announcements-view .flex.items-center.justify-between.mb-4 { margin-bottom: 0.5rem !important; }

  /* AI drawer: full-width on mobile */
  #ai-drawer-panel { width: 100% !important; right: 0 !important; left: 0 !important; border-radius: 20px 20px 0 0 !important; }

  /* Map full-screen on mobile */
  #map-view { padding: 0 !important; margin: 0 !important; }
  #map-view > div:first-child { display: none !important; } /* hide desktop header */
  #map-view > div:nth-child(2) { display: none !important; } /* hide legacy filter row */
  #map-view .flex.gap-4 { gap: 0 !important; }
  #map-view .flex.gap-4 > .flex-1 {
    width: 100% !important;
    height: calc(100vh - 3.5rem - 4rem) !important;
    min-height: 300px !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }
  /* Map fullscreen — NO overflow:hidden (kills MapLibre) */
  .map-fullscreen-active { padding: 0 !important; }
  /* The bottom-nav spacer is for scrollable content; a full-bleed map already
     sizes itself around the nav, so the spacer only adds dead scroll below it. */
  .map-fullscreen-active #mob-scroll-spacer { display: none !important; }

  /* AI FAB: lift above bottom nav bar on mobile */
  #ai-fab { bottom: 5rem !important; }

  /* Map mobile filter stack scrollbar hide */
  #map-mob-filter-stack [style*="scrollbar-width:none"]::-webkit-scrollbar { display: none; }

  /* Map mobile pill active tap feedback */
  .map-mob-pill:active { opacity: 0.8; transform: scale(0.96); }

  /* Mobile header: dark themed */
  main > header { background: #151b25 !important; }

  /* Make the main dark container match mobile design */
  main { background: #0d1117; }

  /* Listings on mobile: dark background */
  .listing-card {
    background: #1a2232 !important;
    border-color: #2a3548 !important;
  }
  .listing-card h3, .listing-card p { color: #e2e8f0 !important; }

}

/* ═══════════════════════════════════════════════════════════
   JOYMEE Listing Detail — Full-page dashboard redesign
   ═══════════════════════════════════════════════════════════ */

/* ── Page wrapper ── */
.jm-page { display:flex; flex-direction:column; height:100%; overflow:hidden; background:#fff; font-family:'Inter','Open Sauce',sans-serif; color-scheme:light; }

/* ── Header ── */
.jm-header { display:flex; align-items:center; gap:12px; padding:0 20px; height:56px; background:#fff; border-bottom:1px solid #e5e7eb; flex-shrink:0; }
.jm-logo { font-size:20px; font-weight:900; color:#111827; letter-spacing:-0.5px; white-space:nowrap; }
.jm-logo-accent { color:#2563eb; }
.jm-logo-img { height:28px; width:auto; object-fit:contain; flex-shrink:0; }
.jm-lang-btn { background:#f3f4f6; border:1px solid #e5e7eb; border-radius:8px; padding:4px 10px; font-size:12px; font-weight:600; color:#374151; cursor:pointer; }
.jm-header-search { flex:1; max-width:360px; display:flex; align-items:center; gap:8px; background:#f9fafb; border:1px solid #e5e7eb; border-radius:10px; padding:7px 12px; }
.jm-header-search input { border:none; background:transparent; outline:none; font-size:12px; color:#374151; width:100%; }
.jm-hdr-right { display:flex; align-items:center; gap:8px; margin-left:auto; }
.jm-hdr-icon-btn { width:34px; height:34px; display:flex; align-items:center; justify-content:center; border-radius:8px; border:1px solid #e5e7eb; background:#fff; cursor:pointer; color:#6b7280; }
.jm-add-btn { background:#2563eb; color:#fff; font-size:12px; font-weight:700; border:none; border-radius:10px; padding:8px 16px; cursor:pointer; white-space:nowrap; }

/* ── Breadcrumb ── */
.jm-breadcrumb { display:flex; align-items:center; justify-content:space-between; padding:8px 20px; background:#fff; border-bottom:1px solid #e5e7eb; flex-shrink:0; position:relative; }
.jm-back-btn { display:flex; align-items:center; gap:6px; background:none; border:none; font-size:13px; font-weight:600; color:#374151; cursor:pointer; padding:0; transition:color 0.15s; }
.jm-back-btn:hover { color:#2563eb; }
.jm-timestamp { font-size:11px; color:#9ca3af; }

/* ── Main grid — two columns ── */
.jm-main-grid { display:flex; flex:1; min-height:0; overflow:hidden; }

/* ── Left column (40%) ── */
.jm-left-col { width:40%; flex-shrink:0; overflow-y:auto; background:#f4f6f8; border-right:1px solid #e5e7eb; scrollbar-width:thin; scrollbar-color:rgba(0,0,0,0.1) transparent; }
.jm-gallery-wrap { margin:10px 10px 0; }

/* ── Right column (60%) ── */
.jm-right-col { flex:1; min-width:0; overflow-y:auto; background:#fff; scrollbar-width:thin; scrollbar-color:rgba(0,0,0,0.1) transparent; }

/* ══ Gallery ══════════════════════════════════════════════════════════════ */

/* Outer wrapper — white card with large radius + shadow */
.jm-gallery-wrap {
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 4px 24px 0 rgba(43,103,153,0.10);
  margin-bottom: 0;
}

/* ── Main carousel ── */
.jm-carousel {
  position: relative;
  overflow: hidden;
  background: #d1d5db;
  aspect-ratio: 4/3;
  border-radius: 24px 24px 0 0;
}
.jm-carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.4,0,0.2,1);
  will-change: transform;
}
.jm-carousel-track img {
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  flex-shrink: 0;
  cursor: pointer;
  display: block;
}

/* Asset type badge (top-left) */
.jm-asset-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

/* Image counter badge (top-right) */
.jm-img-counter {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.03em;
}

/* Arrow buttons — glassmorphism */
.jm-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  color: #111827;
  line-height: 1;
  padding: 0;
}
.jm-carousel-arrow:hover {
  background: rgba(255,255,255,0.96);
  transform: translateY(-50%) scale(1.10);
  box-shadow: 0 6px 20px rgba(0,0,0,0.22);
}
.jm-carousel-arrow:active { transform: translateY(-50%) scale(0.97); }
.jm-carousel-prev { left: 12px; }
.jm-carousel-next { right: 12px; }

/* Dots */
.jm-carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 5;
  background: rgba(0,0,0,0.28);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-radius: 999px;
  padding: 5px 10px;
}
.jm-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.45);
  transition: all 0.32s cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  flex-shrink: 0;
}
.jm-dot.jm-dot-active {
  background: #fff;
  width: 20px;
  border-radius: 3px;
}

/* ── Thumbnail strip ── */
.jm-thumbs {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
  border-radius: 0 0 24px 24px;
}
.jm-thumbs::-webkit-scrollbar { display: none; }
.jm-thumb {
  flex-shrink: 0;
  width: 66px;
  height: 50px;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  border: 2.5px solid transparent;
  outline: 2.5px solid transparent;
  outline-offset: 1px;
  transition: border-color 0.2s, outline-color 0.2s, opacity 0.2s, transform 0.18s;
  opacity: 0.6;
}
.jm-thumb.jm-thumb-active {
  border-color: #2B6799;
  outline-color: rgba(43,103,153,0.20);
  opacity: 1;
}
.jm-thumb:hover { opacity: 1; }
.jm-thumb:active { transform: scale(0.93); }
.jm-thumb img { width:100%; height:100%; object-fit:cover; display:block; }

/* ── Price panel ── */
.jm-price-panel { padding:16px; background:#fff; border-bottom:1px solid #f3f4f6; }
.jm-price-value { font-size:26px; font-weight:900; color:#111827; line-height:1; margin-bottom:4px; }
.jm-price-m2 { display:inline-block; margin-bottom:4px; font-size:11px; background:#f3f4f6; border-radius:6px; padding:2px 8px; color:#374151; font-weight:600; }
.jm-price-email { font-size:11px; color:#9ca3af; }

/* ── Seller card ── */
.jm-seller-wrap {
  background: #F4F6F8;
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
}
.jm-seller-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 2px 12px 0 rgba(43,103,153,0.07);
}
/* Top row: avatar+info left, stats right */
.jm-seller-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.jm-seller-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2B6799, #1d4ed8);
}
.jm-seller-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.jm-seller-name {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jm-seller-role { font-size: 12px; color: #6b7280; }
.jm-seller-online {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  background: #16a34a;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  width: fit-content;
  letter-spacing: 0.02em;
}
.jm-seller-online::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bbf7d0;
  display: inline-block;
}
/* Stats mini-cards */
.jm-seller-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.jm-seller-stat {
  background: #f9fafb;
  border: 1px solid #f0f1f3;
  border-radius: 14px;
  padding: 7px 12px;
  text-align: center;
  min-width: 78px;
}
.jm-seller-stat-val {
  font-size: 15px;
  font-weight: 800;
  color: #111827;
  line-height: 1.1;
}
.jm-seller-stat-lbl {
  font-size: 9px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
/* Profile button */
.jm-profile-btn {
  width: 100%;
  background: #2B6799;
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}
.jm-profile-btn:hover  { background: #245a84; }
.jm-profile-btn:active { transform: scale(0.98); }
/* Inline stats row — desktop hidden, mobile visible */
.jm-seller-stats-inline { display: none; }

/* ── Title section ── */
.jm-title-section { padding:18px 20px 14px; background:#fff; border-bottom:1px solid #e5e7eb; margin-bottom:6px; }
.jm-listing-title { font-size:18px; font-weight:800; color:#111827; margin:0 0 6px; line-height:1.3; }
.jm-listing-addr { font-size:12px; color:#6b7280; display:flex; align-items:center; gap:4px; margin:0 0 4px; }
.jm-listing-date { font-size:11px; color:#9ca3af; }
.jm-ai-badge { display:inline-flex; align-items:center; gap:5px; margin-top:8px; background:rgba(99,102,241,0.08); border:1px solid rgba(99,102,241,0.2); border-radius:8px; padding:4px 10px; font-size:11px; font-weight:700; color:#6366f1; }

/* ── Structured data table ── */
.jm-data-section { background:#fff; margin-bottom:6px; }
.jm-data-section-label { font-size:11px; font-weight:700; color:#9ca3af; text-transform:uppercase; letter-spacing:0.06em; padding:12px 20px 8px; border-bottom:1px solid #f3f4f6; }
.jm-data-row { display:flex; align-items:flex-start; justify-content:space-between; padding:10px 20px; border-bottom:1px solid #f3f4f6; gap:12px; }
.jm-data-row:last-child { border-bottom:none; }
.jm-data-lbl { font-size:13px; color:#6b7280; flex-shrink:0; }
.jm-data-val { font-size:13px; font-weight:600; color:#111827; text-align:right; }

/* ── CTA buttons ── */
.jm-cta-section { display:flex; gap:8px; flex-wrap:wrap; padding:14px 20px; background:#fff; border-bottom:6px solid #f5f6f8; }
.jm-btn-write { flex:1; min-width:130px; background:#eff6ff; border:1px solid #bfdbfe; border-radius:10px; padding:11px 14px; font-size:12px; font-weight:600; color:#1e40af; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap; transition:background 0.15s; }
.jm-btn-write:hover { background:#dbeafe; }
.jm-btn-call { flex:1; min-width:130px; background:#2563eb; border:1px solid #1d4ed8; border-radius:10px; padding:11px 14px; font-size:12px; font-weight:600; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap; transition:background 0.15s; text-decoration:none; }
.jm-btn-call:hover { background:#1d4ed8; }
.jm-btn-location { background:#111827; border:none; border-radius:10px; padding:11px 16px; font-size:12px; font-weight:600; color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; white-space:nowrap; transition:background 0.15s; }
.jm-btn-location:hover { background:#1f2937; }

/* ── Map section ── */
.jm-map-section { padding:16px 20px; background:#fff; border-bottom:6px solid #f5f6f8; }
.jm-map-section-title { font-size:14px; font-weight:700; color:#111827; margin:0 0 10px; }
.jm-map-search-bar { display:flex; align-items:center; gap:8px; background:#f9fafb; border:1px solid #e5e7eb; border-radius:10px; padding:9px 12px; margin-bottom:10px; }
.jm-map-search-bar input { border:none; background:transparent; outline:none; font-size:12px; color:#374151; width:100%; }
.jm-map-container-wrap { border-radius:12px; overflow:hidden; height:220px; border:1px solid #e5e7eb; margin-bottom:10px; }
.jm-map-container-wrap #listing-detail-map { height:100%; }
.jm-map-footer { display:flex; align-items:center; justify-content:space-between; }
.jm-fullscreen-btn { background:#f3f4f6; border:1px solid #e5e7eb; border-radius:8px; padding:7px 14px; font-size:12px; font-weight:600; color:#374151; cursor:pointer; display:flex; align-items:center; gap:5px; }
.jm-map-icon-btns { display:flex; gap:8px; }
.jm-map-icon-btn { width:34px; height:34px; display:flex; align-items:center; justify-content:center; border-radius:8px; border:1px solid #e5e7eb; background:#fff; cursor:pointer; color:#374151; }
.jm-map-icon-btn:hover { background:#f3f4f6; }

/* ── Infrastructure ── */
.jm-infra-section { padding:16px 20px; background:#fff; border-bottom:6px solid #f5f6f8; }
.jm-section-title { font-size:14px; font-weight:700; color:#111827; margin:0 0 12px; }
.jm-infra-grid { display:grid; grid-template-columns:1fr 1fr; gap:4px 8px; }
.jm-infra-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid #f3f4f6; }
.jm-infra-row:nth-last-child(-n+2) { border-bottom:none; padding-bottom:0; }
.jm-infra-icon-wrap { width:32px; height:32px; border-radius:9px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.jm-infra-label { font-size:12px; color:#374151; font-weight:500; }

/* ── Left-col similar listings ── */
.jm-lc-similar {
  background: #F4F6F8;
  padding: 10px 10px 14px;
}
.jm-lc-similar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 10px;
}
.jm-lc-similar-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
  flex: 1;
}
.jm-lc-similar-count {
  background: #2B6799;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.jm-lc-similar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.jm-lc-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 1px 6px rgba(43,103,153,0.06);
}
.jm-lc-card:hover {
  border-color: #2B6799;
  box-shadow: 0 4px 14px rgba(43,103,153,0.13);
  transform: translateY(-1px);
}
.jm-lc-card:active { transform: scale(0.98); }
.jm-lc-card-img-wrap {
  flex-shrink: 0;
  width: 82px;
  min-height: 68px;
  overflow: hidden;
}
.jm-lc-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.jm-lc-card:hover .jm-lc-card-img { transform: scale(1.04); }
.jm-lc-card-body {
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}
.jm-lc-card-price {
  font-size: 13px;
  font-weight: 800;
  color: #111827;
  margin: 0;
  white-space: nowrap;
}
.jm-lc-card-name {
  font-size: 11px;
  color: #374151;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jm-lc-card-meta {
  font-size: 10px;
  color: #6b7280;
  margin: 0;
}
.jm-lc-card-dist {
  font-size: 10px;
  color: #9ca3af;
  margin: 0;
}

/* ── Related listings ── */
.jm-related-section { padding:16px 20px 24px; background:#fff; }
.jm-related-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:12px; }
.jm-related-nav { display:flex; gap:6px; }
.jm-related-nav-btn { width:32px; height:32px; border-radius:50%; border:1px solid #e5e7eb; background:#fff; cursor:pointer; font-size:20px; display:flex; align-items:center; justify-content:center; color:#374151; line-height:1; padding:0; transition:background 0.15s, border-color 0.15s; }
.jm-related-nav-btn:hover { background:#2563eb; border-color:#2563eb; color:#fff; }
.jm-related-viewport { overflow:hidden; }
.jm-related-track { display:flex; gap:12px; transition:transform 0.42s cubic-bezier(0.4,0,0.2,1); }
.jm-related-card { flex-shrink:0; width:178px; border-radius:12px; overflow:hidden; border:1px solid #e5e7eb; cursor:pointer; background:#fff; transition:box-shadow 0.2s, border-color 0.2s; }
.jm-related-card:hover { border-color:#2563eb; box-shadow:0 4px 16px rgba(37,99,235,0.12); }
.jm-related-card-img { width:100%; height:118px; object-fit:cover; display:block; }
.jm-related-card-body { padding:10px; }
.jm-related-card-price { font-size:14px; font-weight:800; color:#111827; margin:0 0 3px; }
.jm-related-card-name { font-size:11px; color:#6b7280; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.jm-related-card-district { font-size:10px; color:#9ca3af; margin:2px 0 0; }

/* ── Header search hidden (narrow modal) ── */
.jm-header-search { display:none; }

/* ═══════════════════════════════════════════════════════════
   DARK MODE — jm-* listing detail components
   ═══════════════════════════════════════════════════════════ */

/* ── Page & columns ── */
.dark .jm-page { background:#0f1623; color-scheme:dark; }
.dark .jm-header { background:#161f2e; border-color:#1e2d42; }
.dark .jm-logo { color:#f1f5f9; }
.dark .jm-lang-btn { background:#1e2d42; border-color:#2a3d57; color:#cbd5e1; }
.dark .jm-header-search { background:#1e2d42; border-color:#2a3d57; }
.dark .jm-header-search input { color:#e2e8f0; }
.dark .jm-hdr-icon-btn { background:#1e2d42; border-color:#2a3d57; color:#94a3b8; }
.dark .jm-breadcrumb { background:#161f2e; border-color:#1e2d42; }
.dark .jm-back-btn { color:#94a3b8; }
.dark .jm-back-btn:hover { color:#60a5fa; }
.dark .jm-timestamp { color:#475569; }
.dark .jm-left-col { background:#0f1623; border-color:#1e2d42; }
.dark .jm-right-col { background:#0f1623; }

/* ── Gallery card ── */
.dark .jm-gallery-wrap { background:#161f2e; box-shadow:0 4px 24px 0 rgba(0,0,0,0.35); }
.dark .jm-carousel { background:#1e2d42; }
.dark .jm-thumbs { background:#161f2e; }
.dark .jm-thumb { opacity:0.5; }
.dark .jm-thumb.jm-thumb-active { border-color:#2B6799; outline-color:rgba(43,103,153,0.25); opacity:1; }
.dark .jm-thumb:hover { opacity:0.9; }

/* ── Price panel ── */
.dark .jm-price-panel { background:#161f2e; border-color:#1e2d42; }
.dark .jm-price-value { color:#f1f5f9; }
.dark .jm-price-m2 { background:#1e2d42; color:#94a3b8; }
.dark .jm-price-email { color:#475569; }

/* ── Seller card ── */
.dark .jm-seller-wrap { background:#0f1623; }
.dark .jm-seller-card { background:#161f2e; box-shadow:0 2px 12px 0 rgba(0,0,0,0.3); }
.dark .jm-seller-name { color:#f1f5f9; }
.dark .jm-seller-role { color:#64748b; }
.dark .jm-seller-stat { background:#1e2d42; border-color:#2a3d57; }
.dark .jm-seller-stat-val { color:#f1f5f9; }
.dark .jm-seller-stat-lbl { color:#475569; }
.dark .jm-profile-btn { background:#2B6799; }
.dark .jm-profile-btn:hover { background:#245a84; }

/* ── Left-col similar listings ── */
.dark .jm-lc-similar { background:#0f1623; }
.dark .jm-lc-similar-title { color:#f1f5f9; }
.dark .jm-lc-card { background:#161f2e; box-shadow:0 1px 6px rgba(0,0,0,0.25); }
.dark .jm-lc-card:hover { border-color:#2B6799; box-shadow:0 4px 14px rgba(43,103,153,0.2); }
.dark .jm-lc-card-price { color:#f1f5f9; }
.dark .jm-lc-card-name { color:#cbd5e1; }
.dark .jm-lc-card-meta { color:#64748b; }
.dark .jm-lc-card-dist { color:#475569; }

/* ── Title section ── */
.dark .jm-title-section { background:#161f2e; border-color:#1e2d42; }
.dark .jm-listing-title { color:#f1f5f9; }
.dark .jm-listing-addr { color:#64748b; }
.dark .jm-listing-date { color:#475569; }

/* ── Data table ── */
.dark .jm-data-section { background:#0f1623; }
.dark .jm-data-section-label { color:#475569; border-color:#1e2d42; }
.dark .jm-data-row { border-color:#1e2d42; }
.dark .jm-data-lbl { color:#64748b; }
.dark .jm-data-val { color:#e2e8f0; }

/* ── CTA buttons ── */
.dark .jm-cta-section { background:#161f2e; border-color:#0f1623; }
.dark .jm-btn-write { background:#1e3a5f; border-color:#1e40af; color:#93c5fd; }
.dark .jm-btn-write:hover { background:#1e3a6e; }
.dark .jm-btn-call { background:#1d4ed8; border-color:#1e40af; }
.dark .jm-btn-location { background:#1e2d42; border-color:#2a3d57; color:#94a3b8; }
.dark .jm-btn-location:hover { background:#2a3d57; }

/* ── Map section ── */
.dark .jm-map-section { background:#161f2e; border-color:#0f1623; }
.dark .jm-map-section-title { color:#f1f5f9; }
.dark .jm-map-search-bar { background:#1e2d42; border-color:#2a3d57; }
.dark .jm-map-search-bar input { color:#e2e8f0; background:transparent; }
.dark .jm-fullscreen-btn { background:#1e2d42; border-color:#2a3d57; color:#94a3b8; }
.dark .jm-fullscreen-btn:hover { background:#2a3d57; }

/* ── Infrastructure ── */
.dark .jm-infra-section { background:#161f2e; border-color:#0f1623; }
.dark .jm-section-title { color:#f1f5f9; }
.dark .jm-infra-row { border-color:#1e2d42; }
.dark .jm-infra-label { color:#cbd5e1; }

/* ── Related listings (right col) ── */
.dark .jm-related-section { background:#0f1623; }
.dark .jm-related-nav-btn { background:#161f2e; border-color:#1e2d42; color:#94a3b8; }
.dark .jm-related-nav-btn:hover { background:#2B6799; border-color:#2B6799; color:#fff; }
.dark .jm-related-card { background:#161f2e; border-color:#1e2d42; }
.dark .jm-related-card:hover { border-color:#2B6799; box-shadow:0 4px 16px rgba(43,103,153,0.18); }
.dark .jm-related-card-price { color:#f1f5f9; }
.dark .jm-related-card-name { color:#94a3b8; }
.dark .jm-related-card-district { color:#475569; }

/* ════════════════════════════════════════════════════════════════════════
   MOBILE-FIRST LISTING DETAIL REDESIGN  ≤ 767px
   ════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── 1. Full-screen modal (override the 900px×92vh inline styles) ─── */
  #listing-detail-sheet {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  #listing-detail-content { overflow: hidden; height: 100%; }

  /* ── 2. Page: single scrollable column with room for sticky CTA ── */
  .jm-page {
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    position: relative;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* ── 3. Floating breadcrumb overlay (sits on top of the image) ── */
  .jm-breadcrumb {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: transparent;
    border-bottom: none;
    padding: 14px 16px;
    pointer-events: none; /* let taps fall through to image */
  }
  .jm-breadcrumb > * { pointer-events: auto; }
  .jm-back-btn {
    background: rgba(0,0,0,0.48);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    gap: 5px;
  }
  .jm-back-btn:hover { color: #fff; }
  .jm-timestamp {
    background: rgba(0,0,0,0.38);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,0.9);
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
  }
  .jm-logo-img { display: none; }

  /* ── 4. Flatten two-column grid → single flex column ── */
  .jm-main-grid {
    display: flex;
    flex-direction: column;
    overflow: visible;
    height: auto;
    min-height: 0;
  }
  /* display:contents dissolves the column wrappers so their children
     become direct flex items — enables CSS `order` resequencing     */
  .jm-left-col,
  .jm-right-col {
    display: contents;
  }

  /* ── 5. Reorder sections (desired: image → price → title → chars →
           seller → map → infra → similar; CTA is sticky)           ── */
  .jm-gallery-wrap  { order: 1; }
  .jm-price-panel   { order: 2; }
  .jm-title-section { order: 3; }
  .jm-data-section  { order: 4; }
  .jm-seller-wrap   { order: 5; }
  .jm-cta-section   { order: 6; } /* also sticky — see section 11 */
  .jm-map-section   { order: 7; }
  .jm-infra-section { order: 8; }
  .jm-lc-similar    { order: 9; }

  /* ── 6. Full-width carousel — 4:3 aspect ratio ── */
  .jm-gallery-wrap {
    margin: 0;
    border-radius: 0 0 12px 12px;
    box-shadow: none;
    overflow: hidden;
  }
  .jm-carousel {
    aspect-ratio: 4/3;
    height: auto;
    border-radius: 0;
  }
  .jm-thumbs {
    border-radius: 0;
    padding: 10px 12px;
    background: #f4f6f8;
  }
  .jm-thumb { width: 56px; height: 44px; }

  /* ── 7. Price panel — price is the focal point ── */
  .jm-price-panel {
    padding: 20px 20px 12px;
    border-bottom: none;
  }
  .jm-price-value {
    font-size: 34px;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 5px;
  }
  .jm-price-m2 { font-size: 12px; }

  /* ── 8. Title + address ── */
  .jm-title-section {
    padding: 8px 16px 14px;
    margin-bottom: 0;
    border-bottom: 1px solid #f3f4f6;
  }
  .jm-listing-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
  .jm-listing-addr  { font-size: 13px; }
  .jm-listing-date  { font-size: 12px; }

  /* ── 9. Characteristics: clean list with dividers ── */
  .jm-data-section {
    margin-bottom: 0;
    border-bottom: 6px solid #f5f6f8;
    display: block;
    padding: 0 16px 8px;
  }
  .jm-data-section-label {
    padding: 14px 0 8px;
    border-bottom: none;
  }
  .jm-data-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid #f3f4f6;
    border-radius: 0;
    background: transparent;
  }
  .jm-data-row:last-child { border-bottom: none; }
  .jm-data-row[style*="align-items:flex-start"] {
    align-items: flex-start;
    background: transparent;
    border-bottom: 1px solid #f3f4f6;
  }
  .jm-data-lbl {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    text-transform: none;
    letter-spacing: 0;
    flex-shrink: 0;
  }
  .jm-data-val {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    text-align: right;
  }

  /* ── 10. Seller: compact horizontal row ── */
  .jm-seller-wrap {
    padding: 12px 16px;
    background: transparent;
    border-bottom: 6px solid #f5f6f8;
  }
  .jm-seller-card {
    padding: 14px 16px;
    border-radius: 16px;
    gap: 0;
    flex-direction: row;
    align-items: center;
  }
  .jm-seller-top { flex: 1; gap: 12px; align-items: center; }
  .jm-seller-avatar { width: 44px; height: 44px; font-size: 17px; }
  .jm-seller-info { gap: 1px; }
  .jm-seller-name  { font-size: 14px; }
  .jm-seller-role  { font-size: 11px; }
  .jm-seller-stats { display: none; }
  .jm-seller-stats-inline {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
  }
  .jm-seller-stats-inline-sep { color: #d1d5db; }
  .jm-profile-btn  {
    display: inline-flex;
    width: auto;
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 10px;
  }

  /* ── 11. CTA: sticky 50/50 action bar pinned to bottom ── */
  .jm-cta-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(229,231,235,0.6);
    border-bottom: none !important;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.10);
  }
  .jm-btn-write,
  .jm-btn-call {
    flex: 1;
    min-width: 0;
    padding: 14px 12px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 14px;
    justify-content: center;
  }
  .jm-btn-location { display: none; } /* scrolling to map not needed on mobile */

  /* ── 12. Map: 16:9 aspect ratio ── */
  .jm-map-section { padding: 16px; border-bottom: 6px solid #f5f6f8; }
  .jm-map-container-wrap {
    height: unset !important;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
  }
  .jm-map-container-wrap #listing-detail-map { height: 100%; }

  /* ── 13. Infrastructure ── */
  .jm-infra-section { padding: 16px; border-bottom: 6px solid #f5f6f8; }
  .jm-infra-grid { grid-template-columns: 1fr 1fr; }

  /* ── 14. Similar listings: horizontal scroll carousel ── */
  .jm-lc-similar { padding: 14px 0 24px; }
  .jm-lc-similar-header { padding: 0 16px 10px; }
  .jm-lc-similar-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 10px;
    padding: 0 16px 6px;
    scrollbar-width: none;
  }
  .jm-lc-similar-list::-webkit-scrollbar { display: none; }
  .jm-lc-card {
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
    width: 155px;
  }
  .jm-lc-card-img-wrap {
    width: 100% !important;
    height: 108px;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
  }
  .jm-lc-card-body { padding: 8px 10px 10px; }
  .jm-lc-card-price { font-size: 13px; }
  .jm-lc-card-name  { font-size: 11px; }

  /* ── Dark-mode overrides for mobile ── */
  .dark .jm-breadcrumb { background: transparent; border: none; }
  .dark .jm-thumbs { background: #0f1623; }
  .dark .jm-price-value { color: #f1f5f9; }
  .dark .jm-data-val { color: #e2e8f0; }
  .dark .jm-data-row {
    border-color: #1e2d42;
    background: #161f2e;
  }
  .dark .jm-data-row[style*="align-items:flex-start"] {
    background: transparent;
    border: none;
  }
  .dark .jm-seller-wrap { background: transparent; }
  .dark .jm-cta-section {
    background: rgba(22,31,46,0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-color: rgba(30,45,66,0.8);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.40);
  }
  .dark .jm-seller-stats-inline { color: #64748b; }
  .dark .jm-seller-stats-inline-sep { color: #334155; }
  .dark .jm-data-row { background: transparent; }
  .dark .jm-map-container-wrap { border-color: #1e2d42; }
  .dark .jm-map-section { border-color: #0f1623; }
  .dark .jm-infra-section { border-color: #0f1623; }
  .dark .jm-lc-similar { background: #0f1623; }
}
