:root {
  --navy: #1e3a8a;
  --blue: #3b82f6;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --top-h: 56px;
  --tab-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

body { padding: 0; }

.app-root {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 5000;
  height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.top-bar__title-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 6px;
  background: transparent;
}

.top-bar__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: #eef2ff;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
}

.icon-btn.hidden { display: none; }
.call-btn { background: #dbeafe; color: var(--blue); }
.menu-btn { background: #eef2ff; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.sidebar-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.sidebar-backdrop[hidden] { display: none; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20010;
  width: min(300px, 86vw);
  height: 100%;
  height: 100dvh;
  background: #fff;
  box-shadow: 8px 0 32px rgba(15, 23, 42, 0.18);
  transform: translateX(-110%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.26s;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) 0 calc(12px + var(--safe-bottom));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.sidebar.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}
body.sidebar-open {
  overflow: hidden;
}

.sidebar__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.35rem 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}
.sidebar__head img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}
.sidebar__head strong {
  display: block;
  color: var(--navy);
  font-size: 0.98rem;
}
.sidebar__head span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.sidebar__head > div { flex: 1; min-width: 0; }
.sidebar__close { margin-left: auto; }

.sidebar__nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.6rem;
  gap: 2px;
}
.sidebar__nav a {
  display: block;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  font-size: 0.95rem;
}
.sidebar__nav a:active,
.sidebar__nav a:hover {
  background: #eef2ff;
  color: var(--navy);
}
.sidebar-install {
  color: var(--navy) !important;
  background: #eef2ff;
  margin-bottom: 6px;
  font-weight: 800 !important;
}
.sidebar-install[hidden] { display: none !important; }

.sidebar__foot {
  margin-top: auto;
  padding: 0.85rem;
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--border);
}

.content {
  flex: 1;
  padding: 12px 14px calc(var(--tab-h) + var(--safe-bottom) + 18px);
  animation: fadeIn 0.18s ease;
}

.content.map-mode {
  padding: 0 0 calc(var(--tab-h) + var(--safe-bottom));
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.tab-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(560px, 100%);
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding: 6px 6px var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  z-index: 5000;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  border-radius: 12px;
}

.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--navy); background: #eef2ff; }

.hero {
  background: linear-gradient(145deg, var(--navy) 0%, var(--blue) 70%);
  color: #fff;
  border-radius: 18px;
  padding: 1.25rem 1.15rem 1.35rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.hero-logo {
  display: block;
  width: min(220px, 72%);
  height: auto;
  margin: 0 auto 0.85rem;
}

.hero h2 {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
  line-height: 1.2;
}

.hero p {
  margin: 0 0 1rem;
  opacity: 0.92;
  font-size: 0.95rem;
  line-height: 1.45;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 0;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary { background: #fff; color: var(--navy); }
.btn-ghost { background: rgba(255,255,255,0.16); color: #fff; border: 1px solid rgba(255,255,255,0.28); }
.btn-solid { background: var(--navy); color: #fff; width: 100%; }
.btn-outline {
  background: #fff;
  color: var(--navy);
  border: 1px solid #c7d2fe;
  width: 100%;
}
a.btn-solid,
.contact-card a.btn-solid,
.sidebar__foot a.btn-solid {
  color: #fff;
}
a.btn-outline,
.contact-card a.btn-outline,
.sidebar__foot a.btn-outline {
  color: var(--navy);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 1.1rem 0 0.65rem;
}

.section-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--navy);
}

.link-more {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.card-list { display: flex; flex-direction: column; gap: 10px; }

.prop-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border);
}

.prop-card__img {
  width: 110px;
  height: 100%;
  min-height: 110px;
  object-fit: cover;
  background: #e2e8f0;
}

.prop-card__body { padding: 0.7rem 0.75rem; }
.prop-card__price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 0.15rem;
}
.prop-card__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.prop-card__type {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}

.filters label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0.55rem 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.filters input[type="text"],
.filters select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.chip input { margin: 0; accent-color: var(--navy); }
.chip:has(input:checked) {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: var(--navy);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.status-box {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.status-box.error { color: var(--danger); }

.pager {
  display: flex;
  gap: 8px;
  margin-top: 1rem;
}
.pager .btn { flex: 1; }

.more-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.more-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 650;
  box-shadow: var(--shadow);
}

.more-item span { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.more-item--install {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: var(--navy);
}

.install-page { padding-bottom: 0.5rem; }
.install-hero {
  background: linear-gradient(145deg, var(--navy) 0%, var(--blue) 70%);
  color: #fff;
  border-radius: 18px;
  padding: 1.25rem 1.15rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  text-align: center;
}
.install-hero__icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  padding: 8px;
  margin-bottom: 0.75rem;
}
.install-hero h2 {
  margin: 0 0 0.4rem;
  font-size: 1.35rem;
}
.install-hero p {
  margin: 0;
  opacity: 0.92;
  font-size: 0.92rem;
  line-height: 1.45;
}
.install-detect { margin-bottom: 0.85rem; }
.install-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 1rem;
}
.install-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.install-steps {
  margin: 0;
  padding-left: 1.25rem;
  color: #334155;
  line-height: 1.55;
  font-size: 0.95rem;
}
.install-steps li { margin-bottom: 0.65rem; }
.install-share {
  display: inline-flex;
  vertical-align: -3px;
  margin: 0 2px;
  color: var(--navy);
}
.install-sub {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  color: var(--navy);
}
.install-alt {
  margin: 0 0 0.75rem;
  color: #475569;
  font-size: 0.92rem;
  line-height: 1.45;
}

.contact-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-top: 0.75rem;
}

.contact-card p { margin: 0.35rem 0; color: #334155; line-height: 1.45; }
.contact-card a { color: var(--navy); font-weight: 700; text-decoration: none; }
.contact-remax {
  display: block;
  width: min(160px, 55%);
  height: auto;
  margin: 0.85rem 0 0.55rem;
}
.contact-brand-logo {
  display: block;
  width: min(180px, 62%);
  height: auto;
  margin: 0 0 0.85rem;
}
.contact-addr {
  margin: 0 !important;
  font-weight: 600;
  color: var(--text) !important;
}
.contact-city {
  margin: 0.15rem 0 0 !important;
  color: var(--muted) !important;
  font-size: 0.92rem;
}

.prose h2, .prose h3 {
  color: var(--navy);
  margin: 1.1rem 0 0.45rem;
}
.prose p, .prose li {
  color: #334155;
  line-height: 1.55;
  font-size: 0.95rem;
}
.prose ul { padding-left: 1.15rem; }
.prose .quote {
  background: #eef2ff;
  border-left: 4px solid var(--navy);
  padding: 0.85rem 1rem;
  border-radius: 0 12px 12px 0;
  font-style: italic;
  margin: 1rem 0;
}

.testimonial {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}
.testimonial p { margin: 0 0 0.65rem; line-height: 1.5; color: #334155; font-size: 0.92rem; }
.testimonial strong { color: var(--navy); font-size: 0.88rem; }

.detail-hero {
  margin: -12px -14px 0;
  background: #0f172a;
  position: relative;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.detail-hero img {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  background: #334155;
  pointer-events: none;
}
.gallery-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  pointer-events: none;
  z-index: 2;
}
.gallery-swipe-hint {
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  line-height: 1;
  letter-spacing: 0.02em;
}
.gallery-swipe-hint:empty {
  display: none;
}
.gallery-count {
  background: rgba(15, 23, 42, 0.6);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  line-height: 1;
  pointer-events: none;
  margin-left: auto;
}
.gallery-nav {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  pointer-events: none;
  z-index: 2;
}
.gallery-nav button {
  pointer-events: auto;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gallery-fs {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.gallery-fs__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  background: #000;
}
.gallery-bar--fs {
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
  padding-top: max(10px, env(safe-area-inset-top));
}
body.gallery-fs-open {
  overflow: hidden;
}

.detail-panel {
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  margin-top: -16px;
  position: relative;
  padding: 1rem 0.25rem 0.5rem;
}
.detail-price { margin: 0; font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.detail-addr { margin: 0.25rem 0 0.75rem; color: var(--muted); }
.detail-type {
  margin: 0 0 1rem;
  color: #475569;
  font-size: 0.9rem;
}
.specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}
.spec {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.4rem;
  text-align: center;
}
.spec strong { display: block; color: var(--navy); font-size: 1.05rem; }
.spec span { color: var(--muted); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; }

.detail-section {
  margin: 1.25rem 0;
}
.detail-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.info-list,
.feature-list {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.info-row,
.feature-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child,
.feature-row:last-child { border-bottom: 0; }
.info-row--listed {
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}
.info-row--listed .info-label {
  flex: none;
}
.info-value--listed {
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.info-label,
.feature-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  flex: 0 1 42%;
}
.info-value,
.feature-value {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
  flex: 1;
  line-height: 1.35;
}
.room-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.room-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.room-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.room-dims {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.detail-map-section { margin-bottom: 0.5rem; }
.detail-map {
  height: 220px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e2e8f0;
}
.detail-map--embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.detail-map-link {
  margin-top: 10px;
  width: 100%;
}
.detail-cta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.map-wrap {
  position: relative;
  height: calc(100dvh - var(--top-h) - var(--safe-top) - var(--tab-h) - var(--safe-bottom));
  min-height: 360px;
}
#leaflet-map { width: 100%; height: 100%; }
.map-filters {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  z-index: 500;
  background: rgba(255,255,255,0.95);
  border-radius: 14px;
  padding: 0.65rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.map-filters .chip-row { max-height: 64px; overflow: auto; }
.map-filters .btn { margin-top: 8px; min-height: 38px; }

.badge-new {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.tip-card, .feature-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0.65rem;
  box-shadow: var(--shadow);
}
.tip-card h3, .feature-tile h3 {
  margin: 0 0 0.35rem;
  font-size: 0.98rem;
  color: var(--navy);
}
.tip-card p, .feature-tile p {
  margin: 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.45;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0.75rem 0 1rem;
}
.stat {
  background: #eef2ff;
  border-radius: 12px;
  padding: 0.75rem 0.4rem;
  text-align: center;
}
.stat strong { display: block; color: var(--navy); font-size: 1.1rem; }
.stat span { font-size: 0.7rem; color: var(--muted); font-weight: 600; }
