:root {
  --navy: #071f49;
  --navy-soft: #12396d;
  --cyan: #0ab9c4;
  --cyan-dark: #009eaa;
  --coral: #ff6b54;
  --ink: #0b1931;
  --muted: #6f7d92;
  --line: #e7ebf1;
  --surface: #ffffff;
  --soft: #f5f7fa;
  --success: #23a36d;
  --shadow: 0 16px 40px rgba(7, 31, 73, 0.12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: max(
    env(safe-area-inset-top, 0px),
    var(--tg-safe-area-inset-top, 0px),
    var(--tg-content-safe-area-inset-top, 0px)
  );
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--soft);
}

* { box-sizing: border-box; }
html { background: var(--soft); }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 95% -5%, rgba(10, 185, 196, 0.14), transparent 27rem),
    var(--soft);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app-shell {
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 16px calc(94px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(84px + var(--safe-top));
  padding: calc(14px + var(--safe-top)) 2px 12px;
  background: color-mix(in srgb, var(--soft) 91%, transparent);
  backdrop-filter: blur(18px);
}
.brand {
  color: var(--navy);
  font-size: clamp(25px, 6vw, 34px);
  font-weight: 850;
  letter-spacing: -1.7px;
}
.brand span { color: var(--cyan); }
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.avatar-button, .profile-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, var(--navy), var(--cyan));
  box-shadow: 0 9px 24px rgba(7, 31, 73, .2);
  font-weight: 800;
}

.view { display: none; animation: view-in .22s ease both; }
.view.active { display: block; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.launch-notice {
  display: flex;
  gap: 12px;
  margin: 0 0 12px;
  padding: 14px 15px;
  border: 1px solid rgba(10, 185, 196, .24);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(10, 185, 196, .12), rgba(255, 255, 255, .96));
  box-shadow: 0 10px 28px rgba(7, 31, 73, .08);
}
.launch-notice-icon {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  color: white;
  background: linear-gradient(145deg, var(--cyan-dark), var(--cyan));
  box-shadow: 0 7px 16px rgba(10, 185, 196, .24);
  font-size: 17px;
  font-weight: 900;
}
.launch-notice strong {
  display: block;
  margin: 1px 0 4px;
  color: var(--navy);
  font-size: 14px;
}
.launch-notice p {
  margin: 0;
  color: #52627a;
  font-size: 12.5px;
  line-height: 1.42;
}

.search-panel {
  padding: 16px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 26px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
}
.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--soft);
}
.mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}
.mode-button.active {
  color: white;
  background: var(--navy);
  box-shadow: 0 7px 15px rgba(7,31,73,.18);
}
.city-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 64px;
  margin: 12px 0;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: white;
  text-align: left;
  font-size: 20px;
  font-weight: 800;
}
.city-button .pin { margin-right: 12px; color: var(--coral); }
.city-button .chevron { margin-left: auto; color: var(--muted); }
.quick-filters {
  display: flex;
  gap: 8px;
  overflow: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.quick-filters::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--navy);
  background: white;
  font-weight: 700;
}
.filter-chip.active {
  border-color: rgba(10,185,196,.38);
  color: var(--cyan-dark);
  background: rgba(10,185,196,.09);
}
.primary-actions {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
  margin-top: 14px;
}
.primary-button, .secondary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  font-weight: 800;
}
.primary-button {
  color: white;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  box-shadow: 0 12px 24px rgba(10,185,196,.24);
}
.secondary-button {
  border: 1px solid var(--line);
  color: var(--navy);
  background: white;
}
.icon-button {
  border: 0;
  border-radius: 16px;
  color: white;
  background: var(--navy);
  font-size: 20px;
}

.status-card {
  margin: 16px 0;
  padding: 16px;
  border-radius: 20px;
  color: white;
  background: linear-gradient(135deg, var(--navy), var(--navy-soft));
  box-shadow: 0 13px 30px rgba(7,31,73,.18);
}
.status-head, .access-top, .row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.status-head strong { display: block; font-size: 16px; }
.status-head span { color: rgba(255,255,255,.67); font-size: 12px; }
.status-count {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  border-radius: 14px;
  color: var(--navy);
  background: white;
  font-weight: 900;
}
.progress-track {
  height: 6px;
  margin: 14px 0 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255,255,255,.16);
}
.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width .35s ease;
}
.provider-status {
  display: flex;
  gap: 6px;
  overflow: hidden;
  color: rgba(255,255,255,.72);
  font-size: 11px;
  white-space: nowrap;
}
.provider-status span:not(:last-child)::after { content: " ·"; }
.provider-note {
  margin-top: 8px;
  color: rgba(255,255,255,.64);
  font-size: 11px;
  line-height: 1.35;
}
.priority-search-button {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 13px;
  color: var(--navy);
  background: #fff;
  font-weight: 850;
}

.section-heading, .page-heading {
  margin: 24px 2px 14px;
}
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -.6px;
}
h2 { color: var(--navy); }
.page-heading p, .empty-state p, .simple-empty p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.text-button, .link-small {
  padding: 8px 0;
  border: 0;
  color: var(--cyan-dark);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
}

.listing-grid { display: grid; gap: 16px; }
.results-load-more {
  display: block;
  width: 100%;
  margin: 18px 0 8px;
  padding: 15px 18px;
  border: 1px solid rgba(20,174,179,.24);
  border-radius: 18px;
  color: var(--navy);
  background: rgba(255,255,255,.92);
  box-shadow: 0 8px 24px rgba(7,31,73,.07);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}
.listing-card {
  overflow: hidden;
  border: 1px solid rgba(231,235,241,.9);
  border-radius: 22px;
  background: white;
  box-shadow: 0 11px 28px rgba(7,31,73,.08);
}
.listing-card.focused-from-map {
  outline: 3px solid rgba(20,174,179,.55);
  box-shadow: 0 14px 36px rgba(20,174,179,.24);
  animation: map-card-focus 1.1s ease 2;
}
@keyframes map-card-focus {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
.listing-photo {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  background: linear-gradient(135deg, #e8eef5, #d8e9eb);
}
.listing-photo img {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: contain;
  transition: opacity .18s ease;
  cursor: zoom-in;
}
.listing-photo.has-portrait-photo {
  background:
    radial-gradient(circle at 25% 20%, rgba(20, 174, 179, .18), transparent 42%),
    linear-gradient(135deg, #e8eef5, #dbe9ec);
}
.listing-photo img.photo-contain {
  object-fit: contain;
}
.listing-photo img.loading { opacity: .58; }
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  height: 300px;
  color: var(--muted);
  font-weight: 700;
}
.photo-retry-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--navy);
  box-shadow: 0 6px 16px rgba(7,31,73,.16);
  font-size: 12px;
  font-weight: 850;
}
.photo-retry-button:disabled { opacity: .65; }
.photo-loading-placeholder {
  background:
    radial-gradient(circle at 50% 45%, rgba(20, 174, 179, .14), transparent 38%),
    linear-gradient(135deg, #e8eef5, #d8e9eb);
}
.photo-loading-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid rgba(20, 174, 179, .2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: photo-loading-spin .85s linear infinite;
}
.photo-loading-total {
  font-size: 12px;
  font-weight: 800;
  color: var(--teal-dark);
}
@keyframes photo-loading-spin {
  to { transform: rotate(360deg); }
}
.photo-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 46px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: rgba(7,31,73,.72);
  box-shadow: 0 5px 16px rgba(7,31,73,.22);
  font-size: 31px;
  line-height: 1;
  transform: translateY(-50%);
  backdrop-filter: blur(8px);
}
.photo-nav-prev { left: 10px; }
.photo-nav-next { right: 10px; }
.photo-expand {
  position: absolute;
  z-index: 4;
  top: 12px;
  left: 12px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: rgba(7,31,73,.72);
  box-shadow: 0 5px 16px rgba(7,31,73,.22);
  font-size: 22px;
  backdrop-filter: blur(8px);
}
.photo-counter {
  position: absolute;
  z-index: 3;
  bottom: 12px;
  left: 50%;
  padding: 6px 9px;
  border-radius: 10px;
  color: white;
  background: rgba(7,31,73,.72);
  font-size: 11px;
  font-weight: 850;
  transform: translateX(-50%);
  backdrop-filter: blur(8px);
}
.photo-load-progress {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 12px;
  padding: 6px 9px;
  border-radius: 10px;
  color: white;
  background: rgba(7,31,73,.78);
  box-shadow: 0 5px 14px rgba(7,31,73,.18);
  font-size: 11px;
  font-weight: 850;
  backdrop-filter: blur(8px);
}
.photo-load-progress.complete {
  background: rgba(20, 174, 179, .9);
}
.photo-viewer {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: white;
  background: rgba(2, 7, 16, .97);
  touch-action: none;
}
.photo-viewer-stage {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding:
    max(74px, calc(env(safe-area-inset-top) + 58px))
    12px
    max(66px, calc(env(safe-area-inset-bottom) + 48px));
}
.photo-viewer-stage img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity .16s ease;
}
.photo-viewer.loading .photo-viewer-stage img { opacity: .58; }
.photo-viewer-close {
  position: absolute;
  z-index: 3;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  color: white;
  background: rgba(255,255,255,.12);
  font-size: 34px;
  line-height: 1;
  backdrop-filter: blur(12px);
}
.photo-viewer-counter {
  position: absolute;
  z-index: 3;
  top: max(20px, calc(env(safe-area-inset-top) + 6px));
  left: 50%;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.12);
  font-size: 13px;
  font-weight: 850;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}
.photo-viewer-nav {
  position: absolute;
  z-index: 3;
  top: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 62px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  color: white;
  background: rgba(7,31,73,.72);
  font-size: 38px;
  transform: translateY(-50%);
  backdrop-filter: blur(10px);
}
.photo-viewer-prev { left: 10px; }
.photo-viewer-next { right: 10px; }
.favorite-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  color: var(--navy);
  background: rgba(255,255,255,.92);
  box-shadow: 0 6px 18px rgba(7,31,73,.16);
  font-size: 23px;
}
.favorite-button.active { color: var(--coral); }
.favorite-count {
  position: absolute;
  z-index: 3;
  top: 61px;
  right: 12px;
  min-width: 42px;
  padding: 5px 8px;
  border-radius: 11px;
  color: var(--navy);
  background: rgba(255,255,255,.92);
  box-shadow: 0 4px 12px rgba(7,31,73,.12);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}
.distance-badge {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 8px 11px;
  border-radius: 12px;
  color: white;
  background: rgba(7,31,73,.9);
  font-size: 12px;
  font-weight: 800;
}
.listing-body { padding: 20px; }
.listing-price {
  color: var(--navy);
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -.4px;
}
.listing-meta, .listing-address, .source-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}
.listing-address { color: #46556c; }
.listing-address .pin { color: var(--coral); }
.listing-description {
  display: -webkit-box;
  margin: 11px 0 0;
  overflow: hidden;
  color: #536176;
  font-size: 13px;
  line-height: 1.45;
  min-height: 76px;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}
.listing-description.expanded {
  display: block;
  overflow: visible;
  white-space: pre-line;
  -webkit-line-clamp: unset;
}
.listing-details-panel { margin-top: 16px; }
.listing-details-panel section + section { margin-top: 16px; }
.listing-details-panel h4 {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 15px;
}
.listing-details-panel dl {
  display: grid;
  grid-template-columns: minmax(125px, 1fr) 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}
.listing-details-panel dt { color: var(--muted); }
.listing-details-panel dd {
  margin: 0;
  color: var(--ink);
  font-weight: 750;
}
.listing-actions {
  display: flex;
  gap: 8px;
  margin-top: 17px;
}
.listing-actions button {
  flex: 1;
  min-height: 43px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 850;
}
.description-toggle {
  color: var(--cyan-dark);
  background: rgba(10,185,196,.09);
}
.gallery-open-button {
  color: white;
  background: var(--navy);
}
.share-listing {
  width: 100%;
  margin-top: 13px;
  padding: 11px 14px;
  border: 0;
  border-radius: 12px;
  color: white;
  color: var(--navy);
  background: #edf2f7;
  font-size: 13px;
  font-weight: 850;
}
.source-links { margin-top: 14px; }
.photo-source-badge {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(7, 42, 83, .88);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.source-addresses {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 12px;
  background: #fff5df;
  color: #72551d;
  font-size: 12px;
  line-height: 1.35;
}
.source-addresses span { display: block; }
.source-link {
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--cyan-dark);
  background: rgba(10,185,196,.09);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
}

.empty-state, .simple-empty {
  padding: 42px 24px;
  text-align: center;
}
.empty-visual {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 6px auto 24px;
}
.radar-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(10,185,196,.35);
  border-radius: 50%;
}
.ring-one { inset: 22px; }
.ring-two { inset: 45px; }
.radar-home {
  position: absolute;
  inset: 57px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: white;
  background: var(--navy);
  font-size: 25px;
}
.simple-empty span { color: var(--cyan); font-size: 52px; }

.map-view, .picker-map {
  width: 100%;
  height: min(64vh, 620px);
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.picker-map { height: 46vh; min-height: 320px; }
.map-screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.map-back-button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 14px;
  color: white;
  background: var(--navy);
  font-weight: 800;
}
.map-back-button span:first-child { font-size: 21px; }
.map-screen-title {
  min-width: 0;
  flex: 1;
}
.map-screen-title strong,
.map-screen-title small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-screen-title strong { color: var(--navy); font-size: 16px; }
.map-screen-title small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.map-provider-badge {
  padding: 7px 9px;
  border-radius: 10px;
  color: var(--cyan-dark);
  background: rgba(10,185,196,.11);
  font-size: 10px;
  font-weight: 900;
}
body.map-mode {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
body.map-mode .app-shell {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  padding: 0;
}
body.map-mode .topbar,
body.map-mode .launch-notice,
body.map-mode .search-panel,
body.map-mode .status-card,
body.map-mode .section-heading,
body.map-mode .empty-state,
body.map-mode .bottom-nav {
  display: none !important;
}
body.map-mode main,
body.map-mode #searchView {
  width: 100%;
  height: 100%;
}
body.map-mode .view:not(#searchView) { display: none !important; }
body.map-mode .map-screen-header {
  position: fixed;
  z-index: 1200;
  top: 0;
  right: 0;
  left: 0;
  min-height: calc(68px + var(--safe-top));
  padding: calc(12px + var(--safe-top)) 14px 12px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 8px 24px rgba(7,31,73,.14);
  backdrop-filter: blur(18px);
}
body.map-mode .map-view {
  position: fixed;
  z-index: 1;
  inset: 0;
  display: block !important;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  touch-action: auto;
}
.kr-map-popup {
  width: min(270px, 72vw);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.kr-map-popup img {
  display: block;
  width: 100%;
  height: 125px;
  margin-bottom: 10px;
  border-radius: 13px;
  object-fit: cover;
  background: #e8eef5;
}
.kr-map-popup-photo-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 125px;
  margin-bottom: 10px;
  border-radius: 13px;
  color: #657388;
  background: linear-gradient(135deg, #e8eef5, #d8e9eb);
  font-size: 12px;
  font-weight: 800;
}
.kr-map-popup-price {
  color: var(--navy);
  font-size: 18px;
  font-weight: 900;
}
.kr-map-popup-address {
  margin-top: 4px;
  color: #46556c;
  font-size: 12px;
  line-height: 1.35;
}
.kr-map-popup-description {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.kr-map-popup-link {
  display: inline-block;
  margin-top: 9px;
  color: var(--cyan-dark);
  text-decoration: none;
  font-size: 12px;
  font-weight: 850;
}
.kr-map-popup-card {
  display: block;
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border: 0;
  border-radius: 11px;
  color: white;
  background: var(--navy);
  font-size: 12px;
  font-weight: 850;
}
/* Leaflet's positioning rules live locally because Telegram WebView can
   intermittently skip the external stylesheet while still loading its JS. */
.leaflet-container {
  position: relative;
  overflow: hidden;
  outline-offset: 1px;
  -webkit-tap-highlight-color: transparent;
}
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  top: 0;
  left: 0;
}
.leaflet-pane { z-index: 400; }
.leaflet-tile-pane { z-index: 200; }
.leaflet-overlay-pane { z-index: 400; }
.leaflet-shadow-pane { z-index: 500; }
.leaflet-marker-pane { z-index: 600; }
.leaflet-tooltip-pane { z-index: 650; }
.leaflet-popup-pane { z-index: 700; }
.leaflet-map-pane canvas { z-index: 100; }
.leaflet-map-pane svg { z-index: 200; }
.leaflet-tile { visibility: hidden; }
.leaflet-tile-loaded { visibility: inherit; }
.leaflet-zoom-animated { transform-origin: 0 0; }
.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}
.leaflet-top, .leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}
.leaflet-top { top: 0; }
.leaflet-right { right: 0; }
.leaflet-bottom { bottom: 0; }
.leaflet-left { left: 0; }
.map-empty {
  display: grid;
  min-height: 420px;
  place-items: center;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--muted);
  background: white;
  box-shadow: var(--shadow);
  text-align: center;
  line-height: 1.5;
}
.leaflet-control-attribution { font-size: 9px; }
.map-price {
  padding: 7px 9px;
  border: 2px solid white;
  border-radius: 11px;
  color: white;
  background: var(--navy);
  box-shadow: 0 5px 15px rgba(7,31,73,.22);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.saved-list { display: grid; gap: 12px; }
.history-heading { margin-top: 28px; }
.saved-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: white;
  box-shadow: 0 8px 22px rgba(7,31,73,.06);
}
.saved-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.saved-card h2 { margin: 0 0 5px; font-size: 17px; }
.saved-card p { margin: 0; color: var(--muted); font-size: 13px; }
.saved-actions { display: flex; gap: 8px; margin-top: 14px; }
.saved-actions button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  color: var(--navy);
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}
.saved-actions .run-saved { flex: 1; color: white; background: var(--navy); }
.auto-toggle {
  padding: 6px 9px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--soft);
  font-size: 11px;
  font-weight: 800;
}
.auto-toggle.on { color: var(--success); background: rgba(35,163,109,.1); }
.round-add {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 16px;
  color: white;
  background: var(--cyan);
  font-size: 25px;
}

.profile-card, .access-card, .settings-list {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
  box-shadow: 0 10px 26px rgba(7,31,73,.07);
}
.profile-card {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 8px;
  padding: 18px;
}
.profile-avatar { width: 58px; height: 58px; border-radius: 19px; }
.profile-card h1 { margin: 3px 0; }
.profile-card p { margin: 0; color: var(--muted); }
.access-card { margin-top: 14px; padding: 18px; }
.access-card h2 { margin: 4px 0 0; font-size: 19px; }
.access-badge {
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--soft);
  font-size: 11px;
  font-weight: 900;
}
.access-badge.on { color: var(--success); background: rgba(35,163,109,.11); }
.referral-progress { margin: 18px 0; }
.referral-progress > div:first-child {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.referral-progress .progress-track { background: var(--line); }
.admin-stats {
  margin-top: 16px;
  padding: 18px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(7,31,73,.08);
}
.admin-stats h2 { margin: 4px 0 14px; }
.admin-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.admin-summary div {
  padding: 11px;
  border-radius: 13px;
  background: var(--surface);
}
.admin-summary strong { display: block; font-size: 20px; color: var(--navy); }
.admin-summary small { color: var(--muted); }
.admin-users { margin-top: 13px; }
.admin-form, .promo-redeem {
  display: grid;
  gap: 8px;
  margin: 10px 0 16px;
}
.admin-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-form input, .promo-redeem input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
}
.admin-form .secondary-button { min-height: 44px; }
.promo-redeem { grid-template-columns: 1fr auto; margin-top: 12px; }
.promo-redeem .secondary-button { min-height: 44px; margin-top: 0; }
.muted-admin { color: var(--muted); font-size: 12px; }
.admin-user-row button {
  border: 0;
  border-radius: 8px;
  color: #a42b2b;
  background: #fff0f0;
}
.admin-user-row {
  display: grid;
  grid-template-columns: minmax(100px,1fr) repeat(3,auto);
  gap: 9px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.admin-user-row span:not(:first-child) { color: var(--muted); }
.access-card .secondary-button { width: 100%; margin-top: 9px; }
.access-card .primary-button { width: 100%; }
.settings-list { margin-top: 14px; overflow: hidden; }
.settings-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: white;
  text-align: left;
}
.settings-row:last-child { border-bottom: 0; }
.settings-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 11px;
  color: var(--cyan-dark);
  background: rgba(10,185,196,.1);
  font-weight: 900;
}
.settings-row strong, .settings-row small { display: block; }
.settings-row small { margin-top: 3px; color: var(--muted); }

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  max-width: 720px;
  min-height: calc(72px + var(--safe-bottom));
  margin: auto;
  padding: 8px 8px var(--safe-bottom);
  border: 1px solid rgba(231,235,241,.9);
  border-bottom: 0;
  border-radius: 24px 24px 0 0;
  background: rgba(255,255,255,.94);
  box-shadow: 0 -12px 30px rgba(7,31,73,.08);
  backdrop-filter: blur(18px);
}
.nav-button {
  border: 0;
  color: #8994a7;
  background: transparent;
}
.nav-button span, .nav-button small { display: block; }
.nav-button span { height: 27px; font-size: 23px; line-height: 25px; }
.nav-button small { font-size: 10px; font-weight: 750; }
.nav-button.active { color: var(--cyan-dark); }

.sheet-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: end;
  justify-content: center;
  background: rgba(3,17,39,.52);
  backdrop-filter: blur(5px);
}
.filter-sheet, .map-picker-sheet {
  width: min(100%, 720px);
  max-height: 92vh;
  padding: 10px 18px calc(18px + var(--safe-bottom));
  overflow-y: auto;
  border-radius: 28px 28px 0 0;
  background: var(--soft);
  box-shadow: 0 -20px 60px rgba(0,0,0,.2);
  animation: sheet-up .25s ease both;
}
@keyframes sheet-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 99px;
  background: #c7ced8;
}
.sheet-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.sheet-header h2 { margin: 3px 0 0; font-size: 23px; }
.close-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  background: white;
  font-size: 27px;
}
.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field {
  display: block;
  margin-bottom: 11px;
}
.field span {
  display: block;
  margin: 0 0 6px 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.field input, .field select {
  width: 100%;
  height: 50px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: white;
}
.field input:focus, .field select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(10,185,196,.1);
}
.toggle-list, .location-card {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
}
.toggle-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  align-items: center;
  min-height: 66px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row strong, .toggle-row small { display: block; }
.toggle-row small { margin-top: 3px; color: var(--muted); }
.toggle-row input { display: none; }
.toggle-row i {
  position: relative;
  width: 46px;
  height: 27px;
  border-radius: 99px;
  background: #d9dee6;
  transition: .2s;
}
.toggle-row i::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(0,0,0,.16);
  content: "";
  transition: .2s;
}
.toggle-row input:checked + i { background: var(--cyan); }
.toggle-row input:checked + i::after { transform: translateX(19px); }
.location-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 13px;
}
.location-card strong, .location-card small { display: block; }
.location-card small { margin-top: 4px; color: var(--muted); }
.secondary-small {
  height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 11px;
  color: var(--navy);
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}
.location-card .link-small { grid-column: 1 / -1; justify-self: start; }
.sheet-actions {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 10px;
  margin-top: 16px;
}
.map-picker-sheet > p { color: var(--muted); }
.toast {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: calc(92px + var(--safe-bottom));
  left: 20px;
  max-width: 520px;
  margin: auto;
  padding: 13px 16px;
  border-radius: 14px;
  color: white;
  background: rgba(7,31,73,.95);
  box-shadow: 0 12px 30px rgba(7,31,73,.25);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}
.toast.warning { background: rgba(127, 83, 8, .96); }
.toast.error { background: rgba(151, 40, 40, .96); }

@media (min-width: 640px) {
  .app-shell { padding-right: 24px; padding-left: 24px; }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listing-photo, .listing-photo img, .photo-placeholder { height: 215px; min-height: 215px; }
}
@media (max-width: 380px) {
  .field-group { grid-template-columns: 1fr; gap: 0; }
  .quick-filters .filter-chip { padding: 0 11px; }
  .mode-button { font-size: 11px; }
  .admin-form { grid-template-columns: 1fr; }
}
