/* =========================================================================
   MyRentKenya — marketplace design system
   -------------------------------------------------------------------------
   Hand-authored on purpose. The production deployment has no Node build step,
   so a Vite/Tailwind dependency would be a deployment risk on a live app that
   handles M-Pesa. This file is ~20KB uncompressed, cached for a year, and
   contains only what the marketplace actually uses — which on a Kenyan mobile
   connection beats a utility framework's output.

   Mobile-first: every component is styled for a 360px viewport first, then
   enhanced at 640 / 900 / 1200. Nothing here assumes a mouse or hover.

   Contents
     01 Tokens
     02 Base + reset
     03 Layout primitives
     04 Typography
     05 Buttons + form controls
     06 Header + navigation
     07 Hero + search
     08 Badges + trust
     09 Listing card + rails
     10 Filters
     11 Results
     12 Listing detail
     13 States (empty / error / loading)
     14 Footer
     15 Utilities
   ========================================================================= */

/* == 01 Tokens ========================================================== */

:root {
  /* Brand — taken straight from the logo: #0581D0 azure on black.
     The whole ramp keeps the logo's hue (203deg) and saturation and only
     walks lightness, so every tint is demonstrably the same colour. */
  --brand-50:  #eef8fe;
  --brand-100: #d6eefc;
  --brand-200: #abdbfa;
  --brand-300: #6cc4fb;
  --brand-400: #26a8fa;
  --brand-500: #0581d0;   /* the logo blue, exactly */
  --brand-600: #046eb1;
  --brand-700: #03588e;
  --brand-800: #034975;
  --brand-900: #023c61;
  --brand-950: #01273e;

  /* Neutrals */
  --n-0:   #ffffff;
  --n-25:  #fcfcfd;
  --n-50:  #f8fafc;
  --n-100: #f1f5f9;
  --n-200: #e2e8f0;
  --n-300: #cbd5e1;
  --n-400: #94a3b8;
  --n-500: #64748b;
  --n-600: #475569;
  --n-700: #334155;
  --n-800: #1e293b;
  --n-900: #0f172a;
  --n-950: #020617;

  /* Tint — a wash of the brand blue. Gives the page a fourth band treatment
     without introducing a colour the brand does not own. */
  --tint-50:  #f4fafe;
  --tint-100: #e4f2fd;
  --tint-200: #c8e5fb;

  /* Ink — the logo's black, pulled a few degrees toward the brand hue so the
     dark sections read as the same family rather than as neutral charcoal. */
  --ink-800: #0a1822;
  --ink-900: #061118;
  --ink-950: #03090d;

  /* Semantic */
  --positive:   #059669;
  --positive-bg:#ecfdf5;
  --warning:    #b45309;
  --warning-bg: #fffbeb;
  --critical:   #b91c1c;
  --critical-bg:#fef2f2;
  --info:       #1d4ed8;
  --info-bg:    #eff6ff;

  /* Sample data is always this amber. One colour, used nowhere else, so the
     reader learns it means "not real" after seeing it once. */
  --sample:     #92400e;
  --sample-bg:  #fef3c7;
  --sample-line:#f59e0b;

  /* Surfaces */
  --bg:          var(--n-50);
  --surface:     var(--n-0);
  --surface-alt: var(--n-100);
  --border:      var(--n-200);
  --border-strong: var(--n-300);
  --text:        var(--n-900);
  --text-muted:  var(--n-500);
  --text-subtle: var(--n-400);
  --text-invert: var(--n-0);

  /* Type — fluid, capped so desktop never gets silly */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --fs-xs:   0.75rem;
  --fs-sm:   0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md:   1rem;
  --fs-lg:   1.125rem;
  --fs-xl:   1.375rem;
  --fs-2xl:  clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  --fs-3xl:  clamp(1.875rem, 1.3rem + 2.6vw, 2.75rem);
  /* Display, for the hero only. Fluid from a 360px phone to a 1440px desktop. */
  --fs-display: clamp(2rem, 1.2rem + 3.6vw, 3.75rem);

  /* Space — 4px base */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.25rem;  --s-6: 1.5rem;   --s-8: 2rem;     --s-10: 2.5rem;
  --s-12: 3rem;    --s-16: 4rem;    --s-20: 5rem;

  --r-sm: 6px;  --r-md: 10px;  --r-lg: 14px;  --r-xl: 20px;  --r-full: 999px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 2px 8px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .12), 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-nav:0 -2px 16px rgba(15, 23, 42, .08);

  --header-h: 60px;
  --bottomnav-h: 60px;
  --container: 1240px;

  --ease: cubic-bezier(.2, .8, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          var(--n-950);
    --surface:     #0b1220;
    --surface-alt: #131c2e;
    --border:      #1e293b;
    --border-strong:#2b3a51;
    --text:        #e9eef6;
    --text-muted:  #94a3b8;
    --text-subtle: #64748b;

    --positive-bg:#052e22;
    --warning-bg: #2a1c05;
    --critical-bg:#2c0b0b;
    --info-bg:    #0b1c3d;
    --sample-bg:  #2e1f05;
    --sample:     #fbbf24;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, .45);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    --shadow-nav:0 -2px 16px rgba(0, 0, 0, .5);
  }
}

/* == 02 Base + reset ==================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

/* Icons ship without width/height attributes so they scale with their context.
   This gives them an intrinsic size; the rule above would otherwise let them
   stretch to fill whatever they sit inside. Component rules below override it. */
.mrk-icon {
  width: 1.15em; height: 1.15em; flex: none;
  /* inline-block, not the reset's block, so an icon after link text stays on
     the same line instead of wrapping onto its own row */
  display: inline-block; vertical-align: -.15em;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--brand-200); color: var(--n-900); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--brand-700); color: #fff;
  padding: var(--s-3) var(--s-4); border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus { left: 0; }

/* == 03 Layout primitives =============================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-4);
}
@media (min-width: 900px) { .container { padding-inline: var(--s-8); } }

.section { padding-block: var(--s-8); }
@media (min-width: 900px) { .section { padding-block: var(--s-12); } }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4); margin-bottom: var(--s-5);
}
.section-head p { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 2px; }
.section-head a { color: var(--brand-700); font-weight: 600; font-size: var(--fs-sm); white-space: nowrap; }
@media (prefers-color-scheme: dark) { .section-head a { color: var(--brand-400); } }

.stack > * + * { margin-top: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.spacer { flex: 1 1 auto; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* == 04 Typography ====================================================== */

.h1 { font-size: var(--fs-3xl); line-height: 1.12; font-weight: 800; letter-spacing: -.022em; }
.h2 { font-size: var(--fs-2xl); line-height: 1.2;  font-weight: 750; letter-spacing: -.018em; }
.h3 { font-size: var(--fs-xl);  line-height: 1.3;  font-weight: 700; letter-spacing: -.012em; }
.h4 { font-size: var(--fs-lg);  line-height: 1.35; font-weight: 650; }

.lede { font-size: var(--fs-lg); color: var(--text-muted); line-height: 1.5; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }

.prose p + p { margin-top: var(--s-4); }
.prose { max-width: 68ch; color: var(--text); }

/* == 05 Buttons + form controls ========================================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px;                     /* thumb target, never smaller */
  padding: 0 var(--s-5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: var(--fs-base); font-weight: 600;
  cursor: pointer; text-align: center;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-alt); }

.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--surface-alt); }

.btn-whatsapp { background: #128c7e; color: #fff; }
.btn-whatsapp:hover { background: #0f7267; }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn-lg { min-height: 52px; padding: 0 var(--s-6); font-size: var(--fs-md); }

.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field > label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-muted); }

.input, .select {
  width: 100%; min-height: 46px;
  padding: 0 var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
  appearance: none;
}
.input::placeholder { color: var(--text-subtle); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(5, 129, 208, .20);
}

.select {
  padding-right: var(--s-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
}

/* Pill toggles used for beds, subtypes, amenities */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 38px; padding: 0 var(--s-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: var(--fs-sm); font-weight: 550;
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.chip:hover { border-color: var(--brand-400); }
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--brand-600); border-color: var(--brand-600); color: #fff;
}
.chip .count { font-size: var(--fs-xs); opacity: .65; font-variant-numeric: tabular-nums; }
.chip[disabled] { opacity: .4; pointer-events: none; }

/* == 06 Header + navigation ============================================= */

.header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: var(--s-4); height: 100%; }

.logo { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 800; letter-spacing: -.02em; font-size: var(--fs-md); }
/* The real mark. Square, so it needs no crop; the logo's own black reads on
   light surfaces and the white cut-outs read on the ink sections. */
/* Sized from an inline style set by the component. The base reset applies
   `height: auto` to every img, which would otherwise beat the width/height
   attributes and render the mark at its full 1003px. */
.logo-mark-img { flex: none; object-fit: contain; border-radius: 5px; }
.footer-v2 .logo-mark-img, .band-ink .logo-mark-img {
  /* The mark is black on transparent; on ink backgrounds it disappears, so it
     sits on a small light plate rather than being recoloured. */
  background: #fff; padding: 3px;
}
.logo em { font-style: normal; color: var(--brand-600); }
@media (prefers-color-scheme: dark) { .logo em { color: var(--brand-400); } }

.nav-desktop { display: none; }
@media (min-width: 900px) {
  .nav-desktop { display: flex; align-items: center; gap: var(--s-1); }
  .nav-desktop a {
    padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
    font-size: var(--fs-base); font-weight: 550; color: var(--text-muted);
  }
  .nav-desktop a:hover { background: var(--surface-alt); color: var(--text); }
  .nav-desktop a[aria-current="page"] { color: var(--text); font-weight: 650; background: var(--surface-alt); }
}

.header-actions { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }
.header-actions .btn-list { display: none; }
@media (min-width: 640px) { .header-actions .btn-list { display: inline-flex; } }

/* Mobile bottom navigation — five thumb-reachable targets */
.bottom-nav {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
  height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-nav);
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--text-muted);
}
.bottom-nav a[aria-current="page"] { color: var(--brand-600); }
.bottom-nav svg { width: 21px; height: 21px; }
@media (prefers-color-scheme: dark) { .bottom-nav a[aria-current="page"] { color: var(--brand-400); } }

@media (min-width: 900px) { .bottom-nav { display: none; } }
body.has-bottom-nav { padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { body.has-bottom-nav { padding-bottom: 0; } }

/* == 07 Hero + search =================================================== */

.hero {
  position: relative;
  padding-block: var(--s-10) var(--s-8);
  background:
    radial-gradient(1000px 420px at 12% -8%, rgba(5,129,208,.16), transparent 62%),
    radial-gradient(760px 380px at 92% 4%, rgba(3,88,142,.16), transparent 60%);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 900px) { .hero { padding-block: var(--s-16) var(--s-12); } }

.hero h1 { max-width: 18ch; }
.hero .lede { max-width: 52ch; margin-top: var(--s-3); }

.searchbox { margin-top: var(--s-6); }

.search-tabs {
  display: flex; gap: var(--s-1);
  padding: var(--s-1);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  width: fit-content; max-width: 100%;
  overflow-x: auto; scrollbar-width: none;
}
.search-tabs::-webkit-scrollbar { display: none; }
.search-tabs a {
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: 650; color: var(--text-muted);
  white-space: nowrap;
}
.search-tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.search-form {
  margin-top: var(--s-3);
  display: grid; gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
@media (min-width: 760px) {
  .search-form {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr) minmax(0, 1.1fr) auto;
    align-items: end;
    border-radius: var(--r-xl);
    padding: var(--s-4) var(--s-5);
  }
}

.near-me {
  display: inline-flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--fs-sm); font-weight: 600; color: var(--brand-700);
  background: none; border: 0; padding: 0; cursor: pointer;
}
@media (prefers-color-scheme: dark) { .near-me { color: var(--brand-400); } }
.near-me svg { width: 16px; height: 16px; }

.stat-strip {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3);
  margin-top: var(--s-8);
}
@media (min-width: 760px) { .stat-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.stat dt { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat dd { margin: var(--s-1) 0 0; font-size: var(--fs-xl); font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

/* == 08 Badges + trust ================================================== */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 650; line-height: 1.5;
  white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; flex: none; }

.badge-positive { background: var(--positive-bg); color: var(--positive); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning); }
.badge-critical { background: var(--critical-bg); color: var(--critical); }
.badge-info     { background: var(--info-bg);     color: var(--info); }
.badge-neutral  { background: var(--surface-alt); color: var(--text-muted); }

/* Sample marker — deliberately loud, deliberately one colour everywhere */
.badge-sample {
  background: var(--sample-bg);
  color: var(--sample);
  border: 1px solid color-mix(in srgb, var(--sample-line) 55%, transparent);
  letter-spacing: .06em; text-transform: uppercase;
}

.sample-banner {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--sample-bg);
  border: 1px solid color-mix(in srgb, var(--sample-line) 50%, transparent);
  border-radius: var(--r-md);
  color: var(--sample);
  font-size: var(--fs-sm);
}
.sample-banner svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.sample-banner strong { display: block; font-weight: 700; }

/* Live availability — the platform's core trust claim, so it gets its own look */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px var(--s-2);
  border-radius: var(--r-sm);
  background: var(--positive-bg); color: var(--positive);
  font-size: var(--fs-xs); font-weight: 700;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 0 rgba(5, 150, 105, .55);
  animation: live-pulse 2.4s var(--ease) infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(5, 150, 105, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

.trust-panel { padding: var(--s-4); }
.trust-row {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding-block: var(--s-3);
}
.trust-row + .trust-row { border-top: 1px solid var(--border); }
.trust-icon {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
}
.trust-icon svg { width: 16px; height: 16px; }
.trust-icon.yes { background: var(--positive-bg); color: var(--positive); }
.trust-icon.no  { background: var(--surface-alt);  color: var(--text-subtle); }
.trust-row .label { font-weight: 600; font-size: var(--fs-sm); }
.trust-row .desc  { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 1px; }

/* == 09 Listing card + rails ============================================ */

.listing-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
}
@media (hover: hover) {
  .listing-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }
}
.listing-card:focus-within { box-shadow: var(--shadow-lg); }

.listing-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  overflow: hidden;
}
.listing-media img { width: 100%; height: 100%; object-fit: cover; }

.listing-media-badges {
  position: absolute; inset-inline: var(--s-2); top: var(--s-2);
  /* leaves room for the save control in the opposite corner */
  padding-right: 42px;
  display: flex; flex-wrap: wrap; gap: var(--s-1);
  pointer-events: none;
}

/* Top-right, the conventional position — and it keeps the bottom edge clear for
   the photo count and, on sample imagery, the "illustration only" plate. */
.listing-save {
  position: absolute; right: var(--s-2); top: var(--s-2);
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
}
.listing-save svg { width: 18px; height: 18px; }
.listing-save[aria-pressed="true"] { color: var(--critical); }

.listing-photo-count {
  position: absolute; left: var(--s-2); bottom: var(--s-2);
  padding: 2px var(--s-2); border-radius: var(--r-sm);
  background: rgba(15, 23, 42, .68); color: #fff;
  font-size: var(--fs-xs); font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px;
}
.listing-photo-count svg { width: 13px; height: 13px; }

.listing-body { padding: var(--s-3) var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); flex: 1; }

.listing-price { font-size: var(--fs-lg); font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.listing-price .per { font-size: var(--fs-sm); font-weight: 550; color: var(--text-muted); }

.listing-title {
  font-size: var(--fs-base); font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.listing-card a.stretch::after { content: ""; position: absolute; inset: 0; }

.listing-location {
  display: flex; align-items: center; gap: 5px;
  font-size: var(--fs-sm); color: var(--text-muted);
}
.listing-location svg { width: 14px; height: 14px; flex: none; }

.listing-specs {
  display: flex; flex-wrap: wrap; gap: var(--s-3);
  margin-top: auto; padding-top: var(--s-2);
  border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.listing-specs span { display: inline-flex; align-items: center; gap: 5px; }
.listing-specs svg { width: 15px; height: 15px; }

/* Horizontal rail on mobile, grid on desktop — no carousel JS anywhere */
.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 78%;
  gap: var(--s-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--s-4);
  padding-inline: var(--s-4);
  margin-inline: calc(-1 * var(--s-4));
  padding-bottom: var(--s-2);
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }

@media (min-width: 560px) { .rail { grid-auto-columns: 46%; } }
@media (min-width: 900px) {
  .rail {
    grid-auto-flow: row;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
    padding-inline: 0; margin-inline: 0;
    gap: var(--s-5);
  }
}

/* == 10 Filters ========================================================= */

.filter-bar {
  position: sticky; top: var(--header-h); z-index: 30;
  display: flex; align-items: center; gap: var(--s-2);
  padding-block: var(--s-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-count {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--brand-600); color: #fff;
  font-size: 11px; font-weight: 700;
}

/* Bottom sheet on mobile, side panel on desktop. <dialog> so Esc and the
   backdrop work without a line of JavaScript. */
.sheet {
  border: 0; padding: 0; margin: 0;
  width: 100%; max-width: 100%;
  max-height: 92vh;
  position: fixed; inset: auto 0 0 0;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
}
.sheet::backdrop { background: rgba(2, 6, 23, .55); backdrop-filter: blur(2px); }
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .22s var(--ease); }
@keyframes sheet-up { from { transform: translateY(12%); opacity: .4; } to { transform: none; opacity: 1; } }

@media (min-width: 900px) {
  .sheet {
    inset: 0 0 0 auto; max-width: 420px; max-height: 100vh;
    border-radius: var(--r-xl) 0 0 var(--r-xl);
  }
  .sheet[open] { animation: sheet-in .22s var(--ease); }
  @keyframes sheet-in { from { transform: translateX(6%); opacity: .5; } to { transform: none; opacity: 1; } }
}

.sheet-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
}
.sheet-body { padding: var(--s-4); overflow-y: auto; flex: 1; }
.sheet-foot {
  display: flex; gap: var(--s-3);
  padding: var(--s-4);
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
}
.sheet-foot .btn { flex: 1; }

.filter-group + .filter-group { margin-top: var(--s-6); padding-top: var(--s-6); border-top: 1px solid var(--border); }
.filter-group > h3 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--s-3); }

.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; color: var(--text-muted);
}
.icon-btn svg { width: 18px; height: 18px; }

/* == 11 Results ========================================================= */

.results-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  padding-block: var(--s-5) var(--s-4);
}

.results-grid {
  display: grid; gap: var(--s-4);
  grid-template-columns: 1fr;
}
@media (min-width: 560px) { .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .results-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); } }

.pagination {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: var(--s-1); margin-top: var(--s-8);
}
.pagination a, .pagination span {
  min-width: 40px; height: 40px; padding: 0 var(--s-2);
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 600; background: var(--surface);
}
.pagination .is-current { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.pagination .is-disabled { opacity: .45; pointer-events: none; }

.seo-links { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-6); }
.seo-links a {
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-full);
  font-size: var(--fs-sm); color: var(--text-muted); background: var(--surface);
}
.seo-links a:hover { color: var(--text); border-color: var(--border-strong); }

/* == 12 Listing detail ================================================== */

/* Shared figure chrome for both gallery presentations */
.gallery figure, .gallery-strip figure {
  position: relative; margin: 0;
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  overflow: hidden;
  border-radius: var(--r-md);
}
.gallery img, .gallery-strip img { width: 100%; height: 100%; object-fit: cover; }
/* Top-left: sample imagery carries its own "illustration only" plate along the
   bottom edge, and two overlapping labels read as a mistake. */
.gallery figcaption, .gallery-strip figcaption {
  position: absolute; left: var(--s-2); top: var(--s-2);
  padding: 2px var(--s-2); border-radius: var(--r-sm);
  background: rgba(15, 23, 42, .66); color: #fff; font-size: var(--fs-xs); font-weight: 600;
  pointer-events: none;
}

/* Mobile: a swipeable strip. Desktop: a mosaic. Exactly one is ever shown —
   the markup renders both, so each must hide the other. */
.gallery-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 88%;
  gap: var(--s-2); overflow-x: auto; scroll-snap-type: x mandatory;
  padding-inline: var(--s-4); margin-inline: calc(-1 * var(--s-4));
  scrollbar-width: none;
}
.gallery-strip::-webkit-scrollbar { display: none; }
.gallery-strip > figure { scroll-snap-align: center; }

.gallery { display: none; }

@media (min-width: 900px) {
  .gallery-strip { display: none; }
  /* One hero tile plus two stacked. Fixed at three so the mosaic can never be
     left with a hole when a listing has four photos. */
  .gallery {
    display: grid; gap: var(--s-2);
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    grid-template-rows: repeat(2, 215px);
    border-radius: var(--r-lg); overflow: hidden;
  }
  .gallery > *:first-child { grid-row: span 2; }
  .gallery > *:only-child { grid-column: span 2; }
  .gallery figure { aspect-ratio: auto; height: 100%; min-height: 0; border-radius: 0; }
}

.gallery-more {
  position: absolute; right: var(--s-2); top: var(--s-2);
  padding: var(--s-2) var(--s-3); border-radius: var(--r-md);
  background: rgba(15, 23, 42, .78); color: #fff;
  font-size: var(--fs-sm); font-weight: 650;
  display: inline-flex; align-items: center; gap: 6px;
}

.gallery-open {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  padding: 0; margin: 0; border: 0;
  background: transparent;
  cursor: zoom-in;
  display: block;
  color: inherit;
}
.gallery-open:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: -2px;
}

.lightbox {
  padding: 0; border: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0;
  background: rgba(3, 9, 13, .96);
  color: #fff;
  overscroll-behavior: contain;
}
.lightbox::backdrop { background: #03090d; }
.lightbox[open] { display: flex; flex-direction: column; }

.lightbox-bar {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding: calc(var(--s-3) + env(safe-area-inset-top)) var(--s-4) var(--s-3);
  background: linear-gradient(to bottom, rgba(3, 9, 13, .7), transparent);
  pointer-events: none;
}
.lightbox-bar > * { pointer-events: auto; }
.lightbox-counter {
  margin: 0;
  font-size: var(--fs-sm); font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.lightbox-ctrl,
.lightbox-nav {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
}
.lightbox-ctrl:hover,
.lightbox-nav:hover { background: rgba(255, 255, 255, .22); }
.lightbox-ctrl svg,
.lightbox-nav svg { width: 22px; height: 22px; }

.lightbox-track {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: auto;
  height: 100%;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.lightbox-track::-webkit-scrollbar { display: none; }

.lightbox-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  margin: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 48px;
}
.lightbox-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r-sm);
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox-slide figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--s-3) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(3, 9, 13, .75), transparent);
  color: #fff; font-size: var(--fs-sm); font-weight: 600;
  text-align: center;
}

.lightbox-nav {
  position: absolute; top: 50%; z-index: 2;
  transform: translateY(-50%);
}
.lightbox-prev { left: var(--s-3); }
.lightbox-next { right: var(--s-3); }
@media (max-width: 639px) {
  .lightbox-nav { display: none; }
}

.detail-layout { display: grid; gap: var(--s-6); }
@media (min-width: 1000px) {
  .detail-layout { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-8); align-items: start; }
  .detail-aside { position: sticky; top: calc(var(--header-h) + var(--s-4)); }
}

.spec-grid {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px) { .spec-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .spec-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.spec {
  padding: var(--s-3);
  background: var(--surface-alt);
  border-radius: var(--r-md);
}
.spec dt { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 600; }
.spec dd { margin: 2px 0 0; font-size: var(--fs-base); font-weight: 650; }

.amenity-grid { display: grid; gap: var(--s-2); grid-template-columns: 1fr; }
@media (min-width: 560px) { .amenity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .amenity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.amenity {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-sm);
}
.amenity svg { width: 15px; height: 15px; color: var(--brand-600); flex: none; }
@media (prefers-color-scheme: dark) { .amenity svg { color: var(--brand-400); } }

.map-placeholder {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-md);
  border: 1px dashed var(--border-strong);
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--surface-alt);
  display: grid; place-items: center; text-align: center; padding: var(--s-5);
}
.map-pin {
  width: 34px; height: 34px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--brand-600);
  box-shadow: var(--shadow-md);
}

/* Sticky action bar — mobile only, sits above the bottom nav */
.action-bar {
  position: fixed; inset-inline: 0;
  bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
  z-index: 42;
  display: flex; gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.action-bar .btn { flex: 1; }
.action-bar .btn-icon { flex: 0 0 48px; padding: 0; }
@media (min-width: 1000px) { .action-bar { display: none; } }

.contact-card { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.contact-identity { display: flex; align-items: center; gap: var(--s-3); }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brand-100); color: var(--brand-800);
  font-weight: 750; font-size: var(--fs-md);
}
@media (prefers-color-scheme: dark) { .avatar { background: var(--brand-900); color: var(--brand-200); } }

.breadcrumbs { display: flex; flex-wrap: wrap; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-muted); padding-block: var(--s-4); }
.breadcrumbs a:hover { color: var(--text); text-decoration: underline; }
.breadcrumbs li::after { content: "›"; margin-left: var(--s-2); color: var(--text-subtle); }
.breadcrumbs li:last-child::after { content: none; }
.breadcrumbs li { display: inline-flex; align-items: center; }

/* == 13 States ========================================================== */

.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--s-3); padding: var(--s-12) var(--s-4);
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  background: var(--surface);
}
.empty-icon {
  width: 52px; height: 52px; border-radius: var(--r-lg);
  display: grid; place-items: center;
  background: var(--surface-alt); color: var(--text-subtle);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty-state p { color: var(--text-muted); max-width: 46ch; }
.empty-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; margin-top: var(--s-2); }

.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 37%, var(--surface-alt) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

.error-state {
  display: flex; gap: var(--s-3); padding: var(--s-4);
  background: var(--critical-bg); color: var(--critical);
  border: 1px solid color-mix(in srgb, var(--critical) 30%, transparent);
  border-radius: var(--r-md); font-size: var(--fs-sm);
}

/* == 14 Footer ========================================================== */

.footer {
  margin-top: var(--s-12);
  padding-block: var(--s-10) var(--s-8);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-grid { display: grid; gap: var(--s-8); grid-template-columns: 1fr; }
@media (min-width: 700px) { .footer-grid { grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); } }
.footer h4 { font-size: var(--fs-sm); font-weight: 700; margin-bottom: var(--s-3); }
.footer li + li { margin-top: var(--s-2); }
.footer a { font-size: var(--fs-sm); color: var(--text-muted); }
.footer a:hover { color: var(--text); }
.footer-legal {
  margin-top: var(--s-8); padding-top: var(--s-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-subtle);
  display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: space-between;
}

/* == 15 Utilities ======================================================= */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hide-mobile { display: none; }
@media (min-width: 900px) { .hide-mobile { display: revert; } .hide-desktop { display: none; } }

.scroll-x { overflow-x: auto; scrollbar-width: thin; }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); }
.mt-6 { margin-top: var(--s-6); }
.mt-8 { margin-top: var(--s-8); }

/* =========================================================================
   16 Landing page
   -------------------------------------------------------------------------
   The homepage is the only place these live. Everything above is shared with
   search and detail; nothing below is used outside the landing experience.

   The governing rule for this page is that no two consecutive sections may
   share a treatment. Light, then full-bleed ink, then brand tint, then editorial
   split — so the page reads as a composed document rather than a stack of
   identical card grids.
   ========================================================================= */

/* -- 16.1 Section rhythm ------------------------------------------------- */

.band { padding-block: var(--s-12); }
@media (min-width: 900px) { .band { padding-block: var(--s-20); } }

.band-tight { padding-block: var(--s-10); }
@media (min-width: 900px) { .band-tight { padding-block: var(--s-12); } }

.band-tint { background: var(--tint-50); border-block: 1px solid var(--tint-100); }
.band-alt  { background: var(--surface-alt); }

.band-ink {
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(5,129,208,.20), transparent 60%),
    radial-gradient(700px 420px at 5% 110%, rgba(162,102,47,.20), transparent 60%),
    var(--ink-900);
  color: #e8f2ec;
}
.band-ink .h2, .band-ink .h3, .band-ink .h4 { color: #fff; }
.band-ink .muted, .band-ink .section-head p { color: #9fb8ac; }
.band-ink .card { background: rgba(255,255,255,.045); border-color: rgba(255,255,255,.10); }
.band-ink .btn-secondary { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.22); color: #fff; }
.band-ink .btn-secondary:hover { background: rgba(255,255,255,.14); }

@media (prefers-color-scheme: dark) {
  .band-tint { background: #08131c; border-block-color: #10202c; }
}

/* A small uppercase kicker above a heading — carries the section's colour. */
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .11em; text-transform: uppercase;
  color: var(--brand-700);
  margin-bottom: var(--s-3);
}
.eyebrow.on-ink { color: var(--brand-400); }
.eyebrow.on-tint { color: var(--brand-700); }
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--brand-400); } }

.band-head { max-width: 62ch; margin-bottom: var(--s-8); }
.band-head .h2 + p { margin-top: var(--s-3); }

/* -- 16.2 Hero ----------------------------------------------------------- */

.hero-v2 {
  position: relative;
  isolation: isolate;
  padding-block: var(--s-12) 0;
  background:
    radial-gradient(1200px 620px at 78% -18%, rgba(5,129,208,.30), transparent 58%),
    radial-gradient(900px 520px at 4% 8%, rgba(3,73,117,.45), transparent 60%),
    linear-gradient(168deg, var(--ink-800) 0%, var(--ink-950) 100%);
  color: #fff;
  /* Visible, not hidden: the search console deliberately overhangs the lower
     edge, and clipping here would slice its rounded bottom off. The decorative
     layers do their own clipping in .hero-scape below. */
  overflow: visible;
}
@media (min-width: 900px) { .hero-v2 { padding-block: var(--s-16) 0; } }

/* Nairobi skyline, darkened so the headline stays readable. */
.hero-scape {
  position: absolute; inset: 0; z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.hero-scape img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 42%;
}
.hero-scape::before {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(6,16,24,.55) 0%, rgba(6,16,24,.72) 55%, rgba(6,16,24,.88) 100%),
    linear-gradient(90deg, rgba(6,16,24,.35), transparent 45%);
}
.hero-scape::after {
  content: ""; position: absolute;
  right: -8%; bottom: -14%; width: 68%; aspect-ratio: 1; z-index: 1;
  background: radial-gradient(circle, rgba(201,154,99,.18), transparent 62%);
}

.hero-copy { text-align: center; }
.hero-v2 h1 {
  font-size: var(--fs-display);
  line-height: 1.05;
  letter-spacing: -.032em;
  font-weight: 800;
  /* em, so the measure scales with the headline itself. In ch it would be
     measured against the inherited body size and collapse to one word a line. */
  max-width: 17em;
  margin-inline: auto;
  text-wrap: balance;
}
.hero-v2 h1 .accent {
  background: linear-gradient(100deg, var(--brand-300), var(--brand-500));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub {
  margin: var(--s-5) auto 0;
  max-width: 56ch;
  font-size: var(--fs-lg);
  line-height: 1.5;
  color: #b9cfc5;
  text-align: center;
  text-wrap: pretty;
}

.hero-trust {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--s-3) var(--s-5);
  margin-top: var(--s-6);
  font-size: var(--fs-sm); color: #9fb8ac;
}
.hero-trust span { display: inline-flex; align-items: center; gap: 7px; }
.hero-trust svg { color: var(--brand-400); }

/* -- 16.3 Search console ------------------------------------------------- */

/* Overlaps the hero's lower edge, which is what makes search read as the
   primary action rather than one element among many. */
.console {
  position: relative; z-index: 2;
  margin-top: var(--s-8);
  transform: translateY(var(--s-8));
}

.console-tabs {
  display: flex; gap: 2px;
  padding: 5px;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: var(--r-full);
  width: fit-content; max-width: 100%;
  margin-inline: auto;
  overflow-x: auto; scrollbar-width: none;
}
.console-tabs::-webkit-scrollbar { display: none; }
.console-tabs a {
  padding: var(--s-2) var(--s-5);
  border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: 650;
  color: rgba(255,255,255,.72);
  white-space: nowrap;
  transition: background-color .16s var(--ease), color .16s var(--ease);
}
.console-tabs a:hover { color: #fff; }
.console-tabs a[aria-current="page"] { background: #fff; color: var(--ink-900); }

.console-card {
  margin-top: var(--s-3);
  /* The hero sets color:#fff and form controls inherit it, which would put
     white text on this white card. Everything inside the card is normal text. */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: 0 24px 60px rgba(3, 11, 8, .28), 0 2px 8px rgba(3, 11, 8, .12);
  padding: var(--s-4);
}
@media (min-width: 900px) { .console-card { padding: var(--s-5) var(--s-6) var(--s-5); } }

.console-fields { display: grid; gap: var(--s-3); }
@media (min-width: 860px) {
  .console-fields {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0;
    align-items: stretch;
  }
  /* Segmented single-control feel: dividers instead of four boxed inputs. */
  .console-fields .field { padding-inline: var(--s-4); justify-content: center; }
  .console-fields .field:first-child { padding-left: var(--s-2); }
  .console-fields .field + .field { border-left: 1px solid var(--border); }
  .console-fields .input, .console-fields .select {
    border: 0; min-height: 40px; padding-inline: 0; background: transparent;
  }
  .console-fields .input:focus, .console-fields .select:focus { box-shadow: none; }
  .console-fields .select { background-position: right 0 center; padding-right: var(--s-6); }
  .console-submit { padding-left: var(--s-4); display: flex; align-items: center; }
}
.console-fields .field > label { font-size: var(--fs-xs); letter-spacing: .04em; text-transform: uppercase; }

.console-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3);
  margin-top: var(--s-4); padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}

.near-me-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-4);
  border-radius: var(--r-full);
  border: 1px solid var(--brand-600);
  background: var(--brand-50);
  color: var(--brand-800);
  font-size: var(--fs-sm); font-weight: 650;
  cursor: pointer;
  transition: background-color .16s var(--ease);
}
.near-me-btn:hover { background: var(--brand-100); }
.near-me-btn .pin-pulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand-600);
  animation: live-pulse 2.4s var(--ease) infinite;
}
@media (prefers-color-scheme: dark) {
  .near-me-btn { background: rgba(5,129,208,.14); color: var(--brand-200); }
  .near-me-btn:hover { background: rgba(5,129,208,.22); }
}

/* -- 16.4 Quick actions -------------------------------------------------- */

.quick-actions {
  display: grid; gap: var(--s-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
/* First band after the hero: the search console already overhangs into it. */
.hero-v2 + .band { padding-top: var(--s-10); }
@media (min-width: 900px) { .hero-v2 + .band { padding-top: var(--s-12); } }
@media (min-width: 760px) { .quick-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.quick-action {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color .16s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease);
}
@media (hover: hover) {
  .quick-action:hover { border-color: var(--brand-400); transform: translateY(-2px); box-shadow: var(--shadow-md); }
}
.quick-action .qa-icon {
  width: 40px; height: 40px; border-radius: var(--r-md); flex: none;
  display: grid; place-items: center;
  background: var(--brand-50); color: var(--brand-700);
}
.quick-action .qa-icon svg { width: 20px; height: 20px; }
.quick-action.accent .qa-icon { background: var(--brand-100); color: var(--brand-800); }
.quick-action > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.quick-action .qa-label { font-weight: 650; font-size: var(--fs-base); line-height: 1.25; }
.quick-action .qa-desc { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; }
@media (prefers-color-scheme: dark) {
  .quick-action .qa-icon { background: rgba(5,129,208,.16); color: var(--brand-200); }
  .quick-action.accent .qa-icon { background: rgba(5,129,208,.22); color: var(--brand-300); }
}

/* -- 16.5 Category bento ------------------------------------------------- */

.bento { display: grid; gap: var(--s-3); grid-template-columns: 1fr; }
@media (min-width: 620px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: 210px 210px; gap: var(--s-4); }
  /* Placed explicitly rather than auto-flowed: the lead tile takes the left
     half, two small tiles sit top-right, and the fourth spans the bottom-right
     pair. Auto-flow would leave the last cell empty. */
  .bento > *:nth-child(1) { grid-column: 1 / span 2; grid-row: 1 / span 2; }
  .bento > *:nth-child(2) { grid-column: 3; grid-row: 1; }
  .bento > *:nth-child(3) { grid-column: 4; grid-row: 1; }
  .bento > *:nth-child(4) { grid-column: 3 / span 2; grid-row: 2; }
}

.tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: flex-end;
  min-height: 210px;
  padding: var(--s-5);
  border-radius: var(--r-lg);
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}
.tile img {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s var(--ease);
}
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(3,11,8,.86) 0%, rgba(3,11,8,.42) 45%, rgba(3,11,8,.12) 100%);
}
@media (hover: hover) { .tile:hover img { transform: scale(1.05); } }
.tile h3 { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.015em; }
.tile p { font-size: var(--fs-sm); color: rgba(255,255,255,.82); margin-top: var(--s-1); max-width: 34ch; }
.tile .tile-count {
  position: absolute; top: var(--s-4); left: var(--s-4);
  padding: 4px var(--s-3); border-radius: var(--r-full);
  background: rgba(255,255,255,.16);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.22);
  font-size: var(--fs-xs); font-weight: 700;
}
.tile .tile-go {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: var(--s-3);
  font-size: var(--fs-sm); font-weight: 650;
}
.tile.is-empty::after { background: linear-gradient(to top, rgba(3,11,8,.88), rgba(3,11,8,.55)); }

/* -- 16.6 Editorial split ------------------------------------------------ */

.split { display: grid; gap: var(--s-6); align-items: center; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-12); }
  .split.reverse > *:first-child { order: 2; }
}
.split-visual {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface-alt);
  box-shadow: var(--shadow-lg);
}
.split-visual img, .split-visual svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* A statistic pinned to the corner of an editorial image. */
.visual-stat {
  position: absolute; left: var(--s-4); bottom: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
  color: var(--n-900);
}
.visual-stat dt { font-size: var(--fs-xs); font-weight: 600; color: var(--n-500); }
.visual-stat dd { margin: 0; font-size: var(--fs-xl); font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.checklist { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.checklist li { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--fs-base); }
.checklist svg { color: var(--brand-600); margin-top: 3px; flex: none; }
.band-ink .checklist svg { color: var(--brand-400); }
.band-tint .checklist svg { color: var(--brand-600); }

/* -- 16.7 Map preview ---------------------------------------------------- */

.mapview {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  /* Near-square: Kenya is taller than it is wide, so a letterbox container
     would waste most of its area on empty margin either side. */
  aspect-ratio: 4 / 5;
  background:
    radial-gradient(520px 420px at 40% 62%, rgba(5,129,208,.14), transparent 62%),
    var(--ink-800);
  border: 1px solid rgba(255,255,255,.10);
}
@media (min-width: 900px) { .mapview { aspect-ratio: 1 / 1; } }
.mapview svg { width: 100%; height: 100%; display: block; }

/* Price pills floated over the map, positioned inline from real coordinates */
.map-pill {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 7px;
  border-radius: var(--r-full);
  background: #fff; color: var(--ink-900);
  font-size: 11px; font-weight: 750;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  font-variant-numeric: tabular-nums;
}
.map-pill.is-live { background: var(--brand-500); color: #fff; }
.map-pill::after {
  content: ""; position: absolute; left: 50%; bottom: -4px;
  width: 8px; height: 8px; background: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.map-legend {
  display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4);
  margin-top: var(--s-3);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* -- 16.8 Verification ladder -------------------------------------------- */

/* Deliberately a ladder, not four equal cards: the whole point is that these
   are different strengths of claim, and equal cards would flatten that. */
.ladder { display: grid; gap: var(--s-3); counter-reset: rung; }
@media (min-width: 900px) { .ladder { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-3); } }

.rung {
  position: relative;
  padding: var(--s-5) var(--s-4) var(--s-4);
  border-radius: var(--r-lg);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
}
.rung .rung-mark {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(5,129,208,.16); color: var(--brand-400);
  margin-bottom: var(--s-3);
}
.rung h3 { font-size: var(--fs-base); font-weight: 700; }
.rung p { font-size: var(--fs-sm); color: #9fb8ac; margin-top: var(--s-2); }
/* Strength increases left to right; the bar makes that legible at a glance. */
.rung::before {
  content: ""; position: absolute; inset-inline: var(--s-4); top: 0; height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--brand-500);
  opacity: calc(.25 + (var(--strength, 1) * .15));
}

.disclaimer {
  margin-top: var(--s-6);
  padding: var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-size: var(--fs-sm); color: #9fb8ac;
  display: flex; gap: var(--s-3);
}
.disclaimer svg { flex: none; margin-top: 2px; color: var(--warning); }

/* -- 16.9 Agent card ----------------------------------------------------- */

.agent-card {
  display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-align: center; align-items: center;
}
.agent-avatar {
  width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-100), var(--brand-200));
  color: var(--brand-800);
  font-size: var(--fs-xl); font-weight: 750;
}
.agent-card .agent-meta { font-size: var(--fs-sm); color: var(--text-muted); }
.agent-stats { display: flex; gap: var(--s-4); font-size: var(--fs-sm); }
.agent-stats b { display: block; font-size: var(--fs-md); }

/* -- 16.10 Journey ------------------------------------------------------- */

.journey { display: grid; gap: var(--s-4); counter-reset: step; }
@media (min-width: 700px)  { .journey { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .journey { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

.step { position: relative; padding-top: var(--s-6); }
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute; top: 0; left: 0;
  font-size: var(--fs-sm); font-weight: 800;
  color: var(--brand-600);
  font-variant-numeric: tabular-nums;
}
.step::after {
  content: ""; position: absolute; top: 9px; left: 22px; right: 0; height: 1px;
  background: var(--border);
}
@media (max-width: 699px) { .step::after { display: none; } }
.step h3 { font-size: var(--fs-base); font-weight: 700; }
.step p { font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--s-1); }

/* -- 16.11 Locations ----------------------------------------------------- */

.location-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .location-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .location-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.location-card {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color .16s var(--ease), background-color .16s var(--ease);
}
.location-card:hover { border-color: var(--brand-400); background: var(--brand-50); }
.location-card .name { font-weight: 650; }
.location-card .count { font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (prefers-color-scheme: dark) { .location-card:hover { background: rgba(5,129,208,.10); } }

/* -- 16.12 Alerts / CTA band --------------------------------------------- */

.cta-band {
  display: grid; gap: var(--s-6);
  padding: var(--s-8);
  border-radius: var(--r-xl);
  background:
    radial-gradient(700px 380px at 90% 0%, rgba(5,129,208,.24), transparent 60%),
    var(--ink-900);
  color: #fff;
}
@media (min-width: 900px) { .cta-band { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; padding: var(--s-10) var(--s-12); } }
.cta-band p { color: #9fb8ac; margin-top: var(--s-3); max-width: 46ch; }
.alert-form { display: grid; gap: var(--s-3); }
@media (min-width: 560px) { .alert-form { grid-template-columns: 1fr auto; } }
.alert-form .input { min-height: 50px; }

/* -- 16.13 Mobile menu --------------------------------------------------- */

.menu-sheet {
  border: 0; padding: 0; margin: 0;
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  position: fixed; inset: 0;
  background: var(--surface); color: var(--text);
}
.menu-sheet::backdrop { background: rgba(2,6,23,.6); }
.menu-sheet[open] { display: flex; flex-direction: column; }
.menu-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4); border-bottom: 1px solid var(--border);
}
.menu-body { padding: var(--s-4); overflow-y: auto; flex: 1; }
.menu-body a.menu-link {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4) var(--s-2);
  font-size: var(--fs-lg); font-weight: 650;
  border-bottom: 1px solid var(--border);
}
.menu-body a.menu-link svg { color: var(--text-subtle); }
.menu-foot { padding: var(--s-4); display: grid; gap: var(--s-3); border-top: 1px solid var(--border); }

/* -- 16.14 Footer (landing) ---------------------------------------------- */

.footer-v2 { background: var(--ink-900); color: #b9cfc5; margin-top: 0; border: 0; }
.footer-v2 .footer-grid { grid-template-columns: 1fr; gap: var(--s-8); }
@media (min-width: 700px)  { .footer-v2 .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .footer-v2 .footer-grid { grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr)); } }
.footer-v2 h4 { color: #fff; }
.footer-v2 a { color: #9fb8ac; }
.footer-v2 a:hover { color: #fff; }
.footer-v2 .footer-legal { border-top-color: rgba(255,255,255,.10); color: #7f958b; }
.footer-v2 .logo em { color: var(--brand-400); }

.social-row { display: flex; gap: var(--s-2); margin-top: var(--s-4); }
.social-row a {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.10);
}
.social-row a:hover { background: rgba(255,255,255,.12); }

/* -- 16.15 Reveal on scroll ---------------------------------------------- */

/* One animation for the whole page, applied sparingly. Anything that has not
   been revealed within 400ms of load is shown regardless, so a failed
   IntersectionObserver can never leave the page blank. */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
  .reveal.is-in { opacity: 1; transform: none; }
}

/* -- 16.16 Tour marker --------------------------------------------------- */

/* Marks an image as tourable. Not a play button: nothing plays yet, and a
   control that does nothing is worse than a label. */
.tour-play {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(3, 11, 8, .34);
  color: #fff;
  pointer-events: none;
}
.tour-play svg { width: 64px; height: 64px; opacity: .95; filter: drop-shadow(0 4px 18px rgba(0,0,0,.5)); }

/* =========================================================================
   17 Map
   -------------------------------------------------------------------------
   Leaflet ships its own stylesheet; everything here is the property-portal
   layer on top of it — price markers instead of pins, a results panel that
   becomes a drag-up sheet on a phone, and a "search this area" affordance.
   ========================================================================= */

.map-page {
  /* Fills the viewport below the header. On mobile the bottom nav is hidden
     on this page so the map gets every pixel it can. */
  position: relative;
  height: calc(100dvh - var(--header-h));
  display: grid;
  /* Explicit minmax(0, 1fr): an implicit auto column takes its width from the
     content's max-content contribution, and Leaflet's panes make that far wider
     than the viewport — which is how the map ends up framed on Uganda. */
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  overflow: hidden;
}
@supports not (height: 100dvh) {
  .map-page { height: calc(100vh - var(--header-h)); }
}

.map-shell { position: relative; min-height: 0; min-width: 0; }
@media (min-width: 1000px) {
  .map-shell { display: grid; grid-template-columns: 400px minmax(0, 1fr); }
}

.map-canvas { position: relative; height: 100%; width: 100%; min-width: 0; background: var(--surface-alt); }
/* Sized by id, not by Leaflet's own class: the class is only added during
   init, so a rule keyed on it leaves the container at zero height at exactly
   the moment Leaflet measures it to work out the initial view. */
#mrk-map { height: 100%; width: 100%; }
.map-canvas .leaflet-container { background: var(--surface-alt); font: inherit; }

/* -- 17.1 Price markers -------------------------------------------------- */

/* A property map's markers should say the price. A generic teardrop makes the
   user click every pin to learn anything. */
.leaflet-marker-icon.price-marker {
  background: none; border: 0;
  width: auto !important; height: auto !important;
  margin: 0 !important;
}
.price-marker-inner {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px;
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--brand-600);
  font-size: 12px; font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(3, 9, 13, .28);
  transform: translate(-50%, -100%);
  transition: background-color .12s var(--ease), color .12s var(--ease), transform .12s var(--ease);
}
.price-marker-inner::after {
  content: ""; position: absolute; left: 50%; bottom: -4px;
  width: 8px; height: 8px; background: inherit;
  border-right: 1.5px solid var(--brand-600); border-bottom: 1.5px solid var(--brand-600);
  transform: translateX(-50%) rotate(45deg);
}
.price-marker-inner.is-live { border-color: var(--positive); }
.price-marker-inner.is-live::after { border-color: var(--positive); }
.price-marker-inner .live-tick { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
.price-marker-inner.is-active,
.leaflet-marker-icon.price-marker:hover .price-marker-inner {
  background: var(--brand-600); color: #fff; border-color: var(--brand-700);
  transform: translate(-50%, -100%) scale(1.06);
  z-index: 500;
}
.price-marker-inner.is-active::after,
.leaflet-marker-icon.price-marker:hover .price-marker-inner::after {
  background: var(--brand-600); border-color: var(--brand-700);
}

/* Aggregate bubbles when zoomed out */
.leaflet-marker-icon.cluster-marker { background: none; border: 0; }
.cluster-bubble {
  display: grid; place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand-600) 88%, transparent);
  color: #fff;
  font-weight: 750; font-variant-numeric: tabular-nums;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 4px 14px rgba(3, 9, 13, .35);
  transform: translate(-50%, -50%);
  line-height: 1.05; text-align: center;
}
.cluster-bubble small { display: block; font-size: 9px; font-weight: 600; opacity: .85; }

/* -- 17.2 Map controls --------------------------------------------------- */

.map-controls {
  position: absolute; right: var(--s-3); top: var(--s-3); z-index: 420;
  display: grid; gap: var(--s-2);
}
.map-btn {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--text); cursor: pointer;
}
.map-btn:hover { background: var(--surface-alt); }
.map-btn svg { width: 19px; height: 19px; }
.map-btn[aria-pressed="true"] { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }

/* Appears only after the user pans — the map does not silently re-query. */
.map-redo {
  position: absolute; left: 50%; top: var(--s-3); z-index: 420;
  transform: translateX(-50%);
  display: none; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-4); min-height: 40px;
  border-radius: var(--r-full);
  background: var(--brand-600); color: #fff;
  border: 0; box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm); font-weight: 650; cursor: pointer;
  white-space: nowrap;
}
.map-redo.is-visible { display: inline-flex; }

.map-status {
  position: absolute; left: var(--s-3); bottom: var(--s-3); z-index: 420;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  max-width: calc(100% - var(--s-16));
}
/* Clears the collapsed results sheet, which owns the bottom edge on a phone. */
.map-status { bottom: calc(74px + var(--s-3)); }
@media (min-width: 1000px) { .map-status { bottom: var(--s-4); } }

.map-spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--border-strong); border-top-color: var(--brand-600);
  display: inline-block; vertical-align: -2px; margin-right: 6px;
  animation: map-spin .7s linear infinite;
}
@keyframes map-spin { to { transform: rotate(360deg); } }

/* -- 17.3 Results panel -------------------------------------------------- */

.map-panel {
  display: none;
  background: var(--bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
}
@media (min-width: 1000px) { .map-panel { display: block; } }

.map-panel-head {
  position: sticky; top: 0; z-index: 2;
  padding: var(--s-4);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.map-panel-list { padding: var(--s-3); display: grid; gap: var(--s-3); }

/* Compact horizontal card, tuned for a 400px rail */
.map-card {
  display: grid; grid-template-columns: 108px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.map-card:hover, .map-card.is-active { border-color: var(--brand-500); box-shadow: var(--shadow-md); }
.map-card-media { position: relative; aspect-ratio: 4/3; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-alt); }
.map-card-media img { width: 100%; height: 100%; object-fit: cover; }
.map-card-body { display: flex; flex-direction: column; gap: 2px; padding: var(--s-1) var(--s-2) var(--s-1) 0; min-width: 0; }
.map-card .price { font-weight: 750; font-size: var(--fs-base); font-variant-numeric: tabular-nums; }
.map-card .name {
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.map-card .meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: auto; }

/* On a phone the panel becomes a sheet that drags up over the map */
.map-sheet {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 430;
  max-height: 62%;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: 0 -8px 30px rgba(3, 9, 13, .22);
  transform: translateY(calc(100% - 74px));
  transition: transform .28s var(--ease);
}
.map-sheet.is-open { transform: translateY(0); }
@media (min-width: 1000px) { .map-sheet { display: none; } }

.map-sheet-grip {
  padding: var(--s-3) var(--s-4);
  display: flex; align-items: center; gap: var(--s-3);
  cursor: pointer; flex: none;
  border-bottom: 1px solid transparent;
}
.map-sheet.is-open .map-sheet-grip { border-bottom-color: var(--border); }
.map-sheet-grip::before {
  content: ""; position: absolute; left: 50%; top: 6px;
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border-strong); transform: translateX(-50%);
}
.map-sheet-body { overflow-y: auto; padding: var(--s-3); display: grid; gap: var(--s-3); }

/* Leaflet popup restyled to match the system */
.leaflet-popup-content-wrapper { border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 0; }
.leaflet-popup-content { margin: 0; width: 240px !important; }
.leaflet-popup-tip { box-shadow: var(--shadow-md); }
.map-popup img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-md) var(--r-md) 0 0; }
.map-popup .body { padding: var(--s-3); display: grid; gap: 3px; }
.map-popup .price { font-weight: 750; font-variant-numeric: tabular-nums; }
.map-popup .name { font-size: var(--fs-sm); font-weight: 600; line-height: 1.3; }
.map-popup .meta { font-size: var(--fs-xs); color: var(--text-muted); }

.leaflet-container a.leaflet-popup-close-button { color: var(--text-muted); }
.leaflet-control-attribution { font-size: 10px; }

/* This page hides the bottom nav so the map keeps the full viewport */
body.map-view.has-bottom-nav { padding-bottom: 0; }
body.map-view .bottom-nav { display: none; }

/* =========================================================================
   18 Account
   -------------------------------------------------------------------------
   The signed-in surface. Built on <details>/<summary>, so it opens, closes
   and takes keyboard focus with no JavaScript; script only adds
   close-on-outside-click.
   ========================================================================= */

.account-menu { position: relative; }
.account-menu > summary { list-style: none; cursor: pointer; }
.account-menu > summary::-webkit-details-marker { display: none; }

.account-trigger {
  display: inline-flex; align-items: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-2) 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface);
  font-size: var(--fs-sm); font-weight: 600;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.account-trigger:hover { border-color: var(--border-strong); background: var(--surface-alt); }
.account-menu[open] > .account-trigger { border-color: var(--brand-500); }

.account-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--brand-600); color: #fff;
  font-size: 13px; font-weight: 750;
}
.account-avatar.lg { width: 42px; height: 42px; font-size: var(--fs-md); }
.account-name { max-width: 9ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* A quiet dot rather than a number: the count already lives in the panel. */
.account-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand-500); flex: none;
}

.account-panel {
  position: absolute; right: 0; top: calc(100% + var(--s-2)); z-index: 60;
  width: min(310px, calc(100vw - var(--s-8)));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: account-in .16s var(--ease);
}
@keyframes account-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.account-head {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
}

.account-group { padding: var(--s-2); }
.account-group + .account-group { border-top: 1px solid var(--border); }

.account-label {
  padding: var(--s-2) var(--s-2) var(--s-1);
  font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-subtle);
}

.account-item {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%;
  padding: var(--s-3) var(--s-2);
  border: 0; background: none;
  border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 550;
  text-align: left; cursor: pointer;
  color: var(--text);
}
.account-item:hover { background: var(--surface-alt); }
.account-item > svg { color: var(--text-muted); flex: none; }
.account-item > span { flex: 1; min-width: 0; }
/* Trailing badges and counts keep their intrinsic width; only the label grows. */
.account-item > .badge, .account-item > .account-count { flex: none; }
.account-sub {
  display: block;
  font-size: var(--fs-xs); font-weight: 450; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-count {
  min-width: 20px; padding: 0 6px; height: 20px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--brand-600); color: #fff;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Count badges on the header icon and the mobile bottom nav */
.icon-btn { position: relative; }
.icon-btn-count, .nav-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 17px; height: 17px; padding: 0 4px;
  display: grid; place-items: center;
  border-radius: var(--r-full);
  background: var(--brand-600); color: #fff;
  font-size: 10px; font-weight: 750; font-variant-numeric: tabular-nums;
  border: 2px solid var(--surface);
}
.bottom-nav a { position: relative; }
.bottom-nav .nav-count { top: 4px; right: calc(50% - 20px); }

/* Saved state on a listing card */
/* Above the card's stretched link. `a.stretch::after` covers the whole card to
   make it clickable, and without a stacking context here it swallows every
   click meant for the save control. */
.listing-save-form { position: absolute; right: var(--s-2); top: var(--s-2); margin: 0; z-index: 3; }
.listing-save-form .listing-save { position: static; }
.listing-card a.listing-save { z-index: 3; }
.listing-save[aria-pressed="true"] { color: var(--critical); }
.listing-save[aria-pressed="true"] svg { fill: currentColor; }
.listing-save.is-busy { opacity: .55; pointer-events: none; }
