/* ============================================================
   Nestloop — Design System
   ============================================================ */

:root {
  /* Brand colors */
  --forest: #14532D;
  --forest-dark: #0F3D21;
  --moss: #22C55E;
  --sage: #D1FAE5;
  --ink: #0F172A;
  --ink-soft: #1E293B;
  --muted: #6B6B5F;
  --mist: #F7F5EF;
  --parchment: #FDFCF7;
  --line: #E8E5DC;
  --line-strong: #D5D0C2;
  --accent: #C2410C;
  --accent-soft: #FED7AA;
  --danger: #B91C1C;
  --danger-soft: #FEE2E2;
  --warning: #92400E;
  --warning-soft: #FEF3C7;

  /* Typography */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing & radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 14px 38px rgba(20, 83, 45, 0.08);

  /* Easing */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 0.6em;
  color: var(--ink);
}
h1 em, h2 em, h3 em {
  font-style: italic;
  color: var(--forest);
  font-weight: 400;
}
p { margin: 0 0 1em; }
a { color: var(--forest); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--forest-dark); }
img { max-width: 100%; display: block; height: auto; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Navigation */
.topbar {
  background: rgba(247, 245, 239, 0.88);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-mark { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; }
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a {
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  position: relative;
  transition: background 0.2s var(--ease);
}
.nav-links a:hover { background: var(--parchment); }
.nav-links a.active { color: var(--forest); }
.nav-links a.active::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--forest);
  border-radius: 2px;
}
.nav-actions { display: flex; gap: 8px; align-items: center; }
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 0.94rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-dark); color: #fff; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--forest); color: var(--forest); }
.btn-ghost { background: transparent; color: var(--ink); padding: 8px 14px; }
.btn-ghost:hover { color: var(--forest); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-lg { padding: 16px 28px; font-size: 1rem; }
.btn-sm { padding: 8px 14px; font-size: 0.85rem; }

/* Pills & badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--sage);
  color: var(--forest);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pill-dot { width: 6px; height: 6px; background: var(--moss); border-radius: 50%; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.badge-success { background: var(--sage); color: var(--forest); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-muted   { background: var(--line); color: var(--muted); }

/* Forms */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.form-label { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.form-hint  { font-size: 0.82rem; color: var(--muted); }
.form-error { font-size: 0.82rem; color: var(--danger); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="number"], input[type="tel"],
input[type="password"], input[type="search"], input[type="date"], input[type="url"],
select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--parchment);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(20, 83, 45, 0.12);
}
textarea { resize: vertical; min-height: 120px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 640px) { .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; } }

/* Section helpers */
.section-eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--forest);
  margin-bottom: 10px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.section-head { margin-bottom: 24px; }

/* Property card */
.property-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.property-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  display: flex;
  flex-direction: column;
}
.property-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.property-card a { color: inherit; display: block; }
.property-photo { aspect-ratio: 4/3; background: var(--mist); position: relative; overflow: hidden; }
.property-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.property-card:hover .property-photo img { transform: scale(1.04); }
.property-badges { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; }
.property-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.property-price { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; letter-spacing: -0.01em; }
.property-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 500; margin: 4px 0; }
.property-address { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }
.property-specs { display: flex; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--muted); margin-top: auto; }

/* Footer */
footer {
  background: var(--forest);
  color: #fff;
  padding: 60px 0 30px;
  margin-top: 80px;
}
footer a { color: rgba(255,255,255,0.75); }
footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr repeat(4, 1fr); gap: 40px; margin-bottom: 40px; }
.footer-tagline { margin-top: 14px; color: rgba(255,255,255,0.7); max-width: 320px; font-size: 0.94rem; }
footer h5 { font-family: var(--font-display); font-size: 0.95rem; font-weight: 500; margin: 0 0 14px; color: #fff; }
footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }
.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  color: rgba(255,255,255,0.55);
  font-size: 0.82rem;
  gap: 20px;
  flex-wrap: wrap;
}

/* Alerts */
.alert { padding: 14px 18px; border-radius: var(--radius-md); margin-bottom: 20px; font-size: 0.94rem; border: 1px solid; }
.alert-success { background: var(--sage); color: var(--forest); border-color: var(--moss); }
.alert-error   { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }
.alert-info    { background: var(--parchment); color: var(--ink); border-color: var(--line-strong); }

/* Card */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 28px; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { max-width: 460px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 40px; box-shadow: var(--shadow-md); }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 24px; font-family: var(--font-display); font-size: 1.4rem; font-weight: 500; }
.auth-title { text-align: center; font-size: 1.8rem; margin-bottom: 6px; }
.auth-sub { text-align: center; color: var(--muted); margin-bottom: 30px; font-size: 0.95rem; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.9rem; color: var(--muted); }

/* Wizard */
.stepper {
  display: flex; gap: 0; margin: 40px 0 0; padding: 0; list-style: none;
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none;
}
.stepper::-webkit-scrollbar { display: none; }
.stepper li {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px; color: var(--muted);
  font-size: 0.9rem; font-weight: 500;
  white-space: nowrap; border-bottom: 2px solid transparent;
}
.stepper li.active { color: var(--forest); border-bottom-color: var(--forest); }
.stepper li.done { color: var(--ink); }
.step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--line); color: var(--muted);
  font-size: 0.82rem; font-weight: 600;
}
.stepper li.active .step-num { background: var(--forest); color: #fff; }
.stepper li.done .step-num { background: var(--moss); color: #fff; }
.wizard { padding: 40px 0 80px; }
.wizard-main { max-width: 720px; margin: 0 auto; }
.step-title { font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; margin-bottom: 6px; }
.step-sub { color: var(--muted); margin-bottom: 32px; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--line); gap: 12px; flex-wrap: wrap; }

.photo-dropzone {
  border: 2px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 44px 24px; text-align: center; background: var(--parchment);
  transition: all 0.2s var(--ease); cursor: pointer;
}
.photo-dropzone:hover, .photo-dropzone.drag-over { border-color: var(--forest); background: rgba(20, 83, 45, 0.02); }
.photo-dropzone .dz-icon { font-size: 2.2rem; margin-bottom: 10px; }
.photo-dropzone .dz-title { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 4px; }
.photo-dropzone .dz-sub { color: var(--muted); font-size: 0.9rem; }

.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.photo-thumb { aspect-ratio: 1; border-radius: var(--radius-md); background: var(--mist); position: relative; overflow: hidden; border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .remove {
  position: absolute; top: 6px; right: 6px;
  background: rgba(15,23,42,0.7); color: #fff; border: none;
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
}
.photo-thumb.primary::after {
  content: "Cover"; position: absolute; bottom: 6px; left: 6px;
  background: var(--forest); color: #fff; padding: 3px 8px;
  border-radius: 999px; font-size: 0.7rem; font-weight: 600;
}
@media (max-width: 640px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }

.feature-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.feature-chip {
  padding: 8px 14px; border: 1px solid var(--line-strong);
  border-radius: 999px; background: #fff;
  font-size: 0.88rem; cursor: pointer;
  transition: all 0.2s var(--ease); user-select: none;
}
.feature-chip:hover { border-color: var(--forest); }
.feature-chip.selected { background: var(--forest); color: #fff; border-color: var(--forest); }

.method-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.method-card { padding: 18px; border: 2px solid var(--line); border-radius: var(--radius-lg); cursor: pointer; transition: all 0.2s var(--ease); }
.method-card.selected { border-color: var(--forest); background: rgba(20,83,45,0.03); }
.method-card input[type="radio"] { margin-bottom: 10px; }
.method-card .mc-title { font-family: var(--font-display); font-weight: 500; font-size: 1.02rem; }
.method-card .mc-sub { color: var(--muted); font-size: 0.84rem; margin-top: 2px; }
@media (max-width: 1024px) { .method-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .method-grid { grid-template-columns: 1fr; } }

/* Browse */
.filter-bar { background: #fff; border-bottom: 1px solid var(--line); padding: 16px 0; position: sticky; top: 70px; z-index: 20; }
.filter-row { display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto; gap: 10px; align-items: center; }
.filter-row input, .filter-row select { padding: 10px 12px; font-size: 0.9rem; margin: 0; }
@media (max-width: 900px) { .filter-row { grid-template-columns: 1fr 1fr; } }

/* Listing detail */
.listing-gallery {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 220px 220px;
  gap: 8px; margin: 24px 0 36px;
  border-radius: var(--radius-lg); overflow: hidden;
}
.listing-gallery .g-main { grid-row: 1 / 3; grid-column: 1; }
.listing-gallery img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; transition: opacity 0.2s var(--ease); }
.listing-gallery img:hover { opacity: 0.92; }
@media (max-width: 768px) {
  .listing-gallery { grid-template-columns: 1fr 1fr; grid-template-rows: 220px 120px; }
  .listing-gallery .g-main { grid-column: 1 / 3; grid-row: 1; }
}
.listing-main { display: grid; grid-template-columns: 1fr 360px; gap: 40px; }
@media (max-width: 960px) { .listing-main { grid-template-columns: 1fr; } }
.listing-price { font-family: var(--font-display); font-size: 2.2rem; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 4px; }
.spec-bar { display: flex; flex-wrap: wrap; gap: 24px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 20px 0; }
.spec-bar .spec { display: flex; flex-direction: column; gap: 2px; }
.spec-bar .spec-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.spec-bar .spec-value { font-family: var(--font-display); font-size: 1.15rem; font-weight: 500; }
.features-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; list-style: none; padding: 0; margin: 14px 0 0; }
.features-list li { padding-left: 24px; position: relative; }
.features-list li::before { content: "✓"; position: absolute; left: 0; color: var(--forest); font-weight: 700; }
.seller-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; position: sticky; top: 100px; }

/* Admin */
.admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 70px); background: var(--mist); }
.admin-side { background: #fff; border-right: 1px solid var(--line); padding: 24px 16px; position: sticky; top: 70px; align-self: start; height: calc(100vh - 70px); overflow-y: auto; }
.admin-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-md); color: var(--ink); font-size: 0.92rem; font-weight: 500; }
.admin-nav a:hover { background: var(--mist); }
.admin-nav a.active { background: var(--sage); color: var(--forest); }
.admin-nav .count-badge { margin-left: auto; background: var(--forest); color: #fff; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; }
.admin-main { padding: 32px 40px; }
.admin-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; }
.admin-head h1 { font-family: var(--font-display); font-size: 1.9rem; font-weight: 500; margin: 0; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.admin-table th, .admin-table td { padding: 14px 18px; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.92rem; }
.admin-table th { font-family: var(--font-display); font-weight: 500; background: var(--parchment); font-size: 0.9rem; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table a { color: var(--forest); font-weight: 500; }
@media (max-width: 768px) { .admin-shell { grid-template-columns: 1fr; } .admin-side { position: static; height: auto; } .admin-main { padding: 24px; } }

/* Responsive */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .menu-toggle { display: inline-flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; }
  .btn-lg { padding: 14px 22px; }
}

/* Utilities */
.text-muted { color: var(--muted); }
.text-forest { color: var(--forest); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.mt-4 { margin-top: 24px; }
.mt-6 { margin-top: 36px; }
.mb-4 { margin-bottom: 24px; }
.flex { display: flex; }
.gap-2 { gap: 12px; }
.gap-4 { gap: 24px; }
.w-full { width: 100%; }
[x-cloak] { display: none !important; }

/* ============================================================
   Browse page — our filter style + prototype's map layout
   ============================================================ */
.browse-filters {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.browse-filters input,
.browse-filters select {
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 0.92rem;
  width: 100%;
}

@media (max-width: 900px) {
  .browse-filters > div[style*="grid-template-columns"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .browse-filters button {
    width: 100%;
  }
}
@media (max-width: 520px) {
  .browse-filters > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

/* Two-column layout: map on left, listings on right */
.browse-wrap {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 32px;
}

/* Map panel */
.map-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  background: var(--parchment);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* Map container + SVG */
.nz-map-container {
  position: relative; /* anchor for the HTML tooltip */
  background: linear-gradient(180deg, #F0EEE5 0%, var(--parchment) 100%);
  border-radius: var(--radius-md);
  padding: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
}
.nz-svg {
  width: 100%;
  height: 480px;
  display: block;
}
.nz-region {
  cursor: pointer;
  transition: filter 0.2s var(--ease);
}
.nz-region:hover {
  filter: brightness(1.08);
}
.nz-region.active {
  fill: var(--forest) !important;
  stroke: #0e3a1e;
  stroke-width: 2;
}
.nz-region:focus {
  outline: none;
  stroke: var(--forest);
  stroke-width: 2;
}

/* HTML tooltip, positioned absolutely inside .nz-map-container */
.nz-tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  padding: 7px 11px;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  z-index: 9999;
}
.nz-tooltip::before {
  content: '';
  position: absolute;
  left: 10px; top: -4px;
  width: 8px; height: 8px;
  background: var(--ink);
  transform: rotate(45deg);
}

/* Region list below map */
.region-list {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.region-list a {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  transition: all 0.15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
}
.region-list a:hover {
  background: var(--sage);
  color: var(--forest);
}
.region-list a.active {
  background: var(--forest);
  color: #fff;
}
.region-list .cnt {
  font-size: 0.72rem;
  opacity: 0.75;
  background: rgba(0,0,0,0.06);
  padding: 2px 7px;
  border-radius: 999px;
}
.region-list a.active .cnt { background: rgba(255,255,255,0.15); }

.clear-filters {
  margin-top: 12px;
  display: block;
  text-align: center;
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.15s;
}
.clear-filters:hover {
  border-color: var(--forest);
  color: var(--forest);
}

/* Listings grid */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.no-results {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 30px;
  background: var(--parchment);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
}
.no-results p { color: var(--muted); margin-top: 8px; }

[x-cloak] { display: none !important; }

@media (max-width: 1024px) {
  .browse-wrap { grid-template-columns: 1fr; gap: 28px; }
  .map-panel { position: static; }
  .listings-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .listings-grid { grid-template-columns: 1fr; }
  .region-list { grid-template-columns: 1fr; }
}

.spec-item .spec-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.spec-item .spec-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.1;
}

.save-btn {
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.18s ease;
  padding: 0;
}
.save-btn:hover {
  border-color: #ea580c;
  background: #fff5f0;
}
.save-btn--active {
  background: #fff5f0;
  border-color: #ea580c;
}
.save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.badge {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Dashboard listing card with owner action bar */
.dashboard-listing-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
}

.dashboard-listing-wrapper .property-card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: none;
}

.card-actions-bar {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.btn-ghost-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--line-strong);
}
.btn-ghost-danger:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: var(--danger);
}

/* ───── Browse page: map hidden state ───── */

.browse-wrap--map-hidden {
  /* When map is hidden, listings take the full width */
  display: block;
}

.browse-wrap--map-hidden #results {
  width: 100%;
}

/* Tiles density picker */
.tiles-picker {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.tiles-picker button {
  background: #fff;
  border: none;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: -0.05em;
  transition: all 0.12s ease;
  border-right: 1px solid var(--line);
}
.tiles-picker button:last-child {
  border-right: none;
}
.tiles-picker button:hover {
  background: var(--parchment);
  color: var(--ink);
}
.tiles-picker button.active {
  background: var(--forest);
  color: #fff;
}

/* Density classes — only applied when map is hidden */
.listings-grid--density-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.listings-grid--density-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.listings-grid--density-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* Responsive overrides: collapse to fewer columns on narrower screens regardless of density choice */
@media (max-width: 1100px) {
  .listings-grid--density-5 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .listings-grid--density-4,
  .listings-grid--density-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .listings-grid--density-3,
  .listings-grid--density-4,
  .listings-grid--density-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .listings-grid--density-3,
  .listings-grid--density-4,
  .listings-grid--density-5 { grid-template-columns: 1fr; }
}

/* ===========================
   Gallery v2 — listing detail
   =========================== */

.gallery-v2 {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0 32px;
}

.gallery-v2__hero {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--mist);
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: transform 0.18s var(--ease, ease-out);
}
.gallery-v2__hero:hover { transform: translateY(-1px); }
.gallery-v2__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.18s ease;
}
.gallery-v2__hero:hover img { opacity: 0.96; }

.gallery-v2__counter {
  position: absolute;
  bottom: 14px;
  right: 14px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.gallery-v2__strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 2px;
  /* Hide scrollbar but keep scrolling */
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.gallery-v2__strip::-webkit-scrollbar { height: 6px; }
.gallery-v2__strip::-webkit-scrollbar-thumb {
  background: rgba(20, 83, 45, 0.2);
  border-radius: 3px;
}

.gallery-v2__thumb {
  flex: 0 0 110px;
  aspect-ratio: 4 / 3;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--mist);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.gallery-v2__thumb:hover { transform: translateY(-1px); }
.gallery-v2__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-v2__thumb.is-active {
  border-color: var(--forest);
  box-shadow: 0 0 0 2px rgba(20, 83, 45, 0.15);
}

@media (max-width: 700px) {
  .gallery-v2__hero { aspect-ratio: 4 / 3; }
  .gallery-v2__thumb { flex-basis: 88px; }
}

/* ===========================
   Lightbox
   =========================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.lightbox[hidden] { display: none !important; }
.lightbox.is-open { opacity: 1; }

.lightbox__stage {
  position: absolute;
  inset: 60px 80px 130px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.13s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox__close {
  position: absolute;
  top: 14px;
  right: 18px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s ease;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.2); }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 2.2rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 4px;
  transition: background 0.15s ease;
}
.lightbox__nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }

.lightbox__counter {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.92rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 14px;
  border-radius: 100px;
  z-index: 2;
}

.lightbox__thumbs {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  max-width: calc(100% - 40px);
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-md);
}
.lightbox__thumbs::-webkit-scrollbar { display: none; }

.lightbox__thumb {
  flex: 0 0 70px;
  aspect-ratio: 4 / 3;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  padding: 0;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.lightbox__thumb:hover { opacity: 1; }
.lightbox__thumb.is-active {
  opacity: 1;
  border-color: #fff;
}
.lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 700px) {
  .lightbox__stage { inset: 60px 12px 110px; }
  .lightbox__nav { width: 40px; height: 40px; font-size: 1.6rem; }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .lightbox__thumb { flex-basis: 56px; }
  .lightbox__close { top: 8px; right: 8px; width: 38px; height: 38px; font-size: 1.4rem; }
}

/* ===========================
   Mobile list view: phones get a horizontal row layout
   for property cards instead of large stacked tiles.
   =========================== */

@media (max-width: 600px) {

  /* Tighter grid spacing on mobile, single column */
  .property-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Card flips to horizontal: thumbnail left, content right */
  .property-card {
    flex-direction: row;
    border-radius: var(--radius-md);
  }

  /* The <a> tag inside the card needs to also be a row container
     since it wraps the photo and body */
  .property-card > a {
    display: flex;
    flex-direction: row;
    width: 100%;
    align-items: stretch;
  }

  /* Thumbnail: fixed-width square-ish, never grows */
  .property-photo {
    flex: 0 0 130px;
    aspect-ratio: 1 / 1;
    border-radius: 0;
  }

  /* Body fills the rest */
  .property-body {
    flex: 1;
    padding: 12px 14px;
    min-width: 0; /* allow text truncation */
  }

  /* Tighter type for the row format */
  .property-price {
    font-size: 1.15rem;
    margin-bottom: 2px;
  }
  .property-title {
    font-size: 0.96rem;
    margin: 2px 0;
    line-height: 1.25;
    /* Truncate to one line — listings with very long titles stay tidy */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .property-address {
    font-size: 0.82rem;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .property-specs {
    gap: 10px;
    padding-top: 8px;
    font-size: 0.78rem;
    flex-wrap: wrap;
  }

  /* "New" badge slightly smaller */
  .property-badges {
    top: 8px;
    left: 8px;
  }
  .property-badges .badge {
    font-size: 0.65rem;
    padding: 2px 6px;
  }

/* Save heart: pin to top-right of the entire card (far right of the body
     area), well clear of the thumbnail and price/title text. */
  .property-card > div[style*="position: absolute"] {
    top: 8px !important;
    right: 8px !important;
    left: auto !important;
    z-index: 3 !important;
  }
  /* Smaller heart button on mobile so it doesn't dominate the row */
  .property-card .save-btn {
    width: 32px !important;
    height: 32px !important;
  }
  .property-card .save-btn svg {
    width: 18px !important;
    height: 18px !important;
  }
  /* Push the body content right-padding so price/title don't get masked
     by the heart sitting in the top-right corner */
  .property-body {
    padding-right: 44px;
  }

  /* Disable hover lift on mobile (no hover, and it confuses tap-to-go behaviour) */
  .property-card:hover {
    transform: none;
    box-shadow: none;
  }
  .property-card:hover .property-photo img {
    transform: none;
  }
}

/* ===========================
   Mobile navigation: hamburger menu below 900px
   =========================== */

/* Hide the mobile-only actions on desktop */
.nav-mobile-actions { display: none; }
.nav-mobile-panel   { display: none; }

/* Hide x-cloak elements before Alpine initialises */
[x-cloak] { display: none !important; }

@media (max-width: 900px) {
  /* Hide desktop nav and actions */
  .topbar .nav-links,
  .topbar .nav-actions {
    display: none;
  }

  /* Show mobile actions */
  .nav-mobile-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  /* Hamburger button */
  .nav-hamburger {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 100px;
    color: var(--ink);
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
  }
  .nav-hamburger:hover {
    background: var(--mist);
  }

  /* Mobile panel */
  .nav-mobile-panel {
    display: block;
    background: #fff;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.06);
  }
  .nav-mobile-panel .container {
    display: flex;
    flex-direction: column;
    padding-top: 12px;
    padding-bottom: 18px;
  }
  .nav-mobile-panel a,
  .nav-mobile-panel button {
    display: block;
    padding: 14px 0;
    font-size: 1rem;
    color: var(--ink);
    text-decoration: none;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-body);
  }
  .nav-mobile-panel a:last-of-type,
  .nav-mobile-panel button:last-of-type {
    border-bottom: 0;
  }
  .nav-mobile-panel a.active {
    color: var(--forest);
    font-weight: 600;
  }
  .nav-mobile-panel a.primary {
    color: var(--forest);
    font-weight: 600;
  }
  .nav-mobile-divider {
    height: 1px;
    background: var(--line-strong, var(--line));
    margin: 6px 0;
  }
  .nav-mobile-panel form {
    border-bottom: 1px solid var(--line);
  }
  .nav-mobile-panel form button {
    border-bottom: 0;
    width: 100%;
  }
}
