:root {
  /* Warm neutral palette */
  --bg: #F4F0E8;          /* linen page */
  --surface: #FBF8F2;     /* card / modal */
  --sand: #ECE5D8;        /* chips, tags */
  --sand-2: #E2D9C8;      /* chip borders, hover */
  --line: #E1D9CB;        /* hairlines */
  --ink: #2B2823;         /* warm charcoal */
  --ink-2: #4A443B;
  --muted: #6E665B;       /* warm gray, 4.9:1 on linen */
  --accent: #3D5A36;      /* forest sage */
  --accent-soft: #E1E6D3;
  --clay: #A4522F;        /* terracotta, used only for Price drop */
  --shadow: 0 1px 2px rgba(74, 56, 30, .06), 0 4px 14px rgba(74, 56, 30, .05);
  --radius: 12px;
  --top: 112px;           /* header + filter chips; JS measures the real height */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); font-weight: 400; }

/* Header. The beds and price bar lives here so it stays on screen while the list scrolls. */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; flex-direction: column; align-items: stretch;
  background: rgba(244,240,232,.94); backdrop-filter: saturate(180%) blur(8px);
  box-shadow: 0 8px 18px rgba(74, 56, 30, .10);
}
.topbar-main {
  display: flex; align-items: center; gap: 28px; min-height: 56px; padding: 0 28px;
}
.brand { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; text-decoration: none; color: inherit; }
.logo { width: 14px; height: 14px; border-radius: 4px; background: var(--accent); display: inline-block; transform: translateY(1px); }
.brand .name { font-weight: 650; font-size: 16px; letter-spacing: -0.01em; }
.brand .note { font-size: 12px; color: var(--muted); }
.brand .note:empty { display: none; }
.cities { display: flex; gap: 4px; padding: 3px; background: var(--sand); border-radius: 999px; }
.city { text-decoration: none; font-size: 13.5px; padding: 5px 12px; border-radius: 999px; color: var(--ink-2); white-space: nowrap; }
.city:hover { color: var(--ink); }
.city.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(74,56,30,.12); }
.city .soon { font-size: 11px; color: var(--muted); margin-left: 2px; }
.account { margin-left: auto; }
.count { margin-left: 14px; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* Compact filter chips. Each chip opens a sheet. The list stays in view underneath. */
.filterbar {
  display: flex; align-items: center;
  border-top: 1px solid var(--line);
  background: rgba(244, 240, 232, .94);
}
.viewswitch {
  flex: none; display: inline-flex; align-items: center; gap: 2px;
  margin: 0 12px 0 0; padding: 3px;
  background: var(--sand); border-radius: 999px;
}
.viewswitch-btn {
  width: 40px; height: 36px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.viewswitch-btn svg { width: 16px; height: 16px; display: block; }
.viewswitch-btn:hover { color: var(--ink); }
.viewswitch-btn[aria-pressed="true"] {
  background: var(--surface); color: var(--accent);
  box-shadow: 0 1px 2px rgba(74, 56, 30, .14);
}
.viewswitch-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.fchips {
  display: flex; gap: 8px; align-items: center; flex: 1 1 auto; min-width: 0;
  overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding: 10px 20px 12px;
}
.fchips::-webkit-scrollbar { display: none; }
.fchip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1.5px solid #C4B49A; background: #FBF8F2; color: var(--ink);
  font-size: 14px; font-weight: 650; letter-spacing: -0.01em; cursor: pointer; white-space: nowrap;
}
.fchip:hover { background: #F3EBDD; }
.fchip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.fchip.on { background: var(--accent); border-color: var(--accent); color: #FBF8F2; }
.fchip.on:hover { background: #31492C; color: #FBF8F2; }
.fchip[aria-expanded="true"] { box-shadow: 0 0 0 3px rgba(61, 90, 54, .28); }
.fchip-text { max-width: 11em; overflow: hidden; text-overflow: ellipsis; }
.fchip-ico { width: 15px; height: 15px; flex: none; }
.fchip-all { position: sticky; left: 0; z-index: 1; box-shadow: 10px 0 12px rgba(244, 240, 232, .96); }
.fchip-all.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fchip-all.on:hover { background: #D5DCC4; color: var(--accent); }
.fchip-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: #FBF8F2; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.fchip-badge[hidden] { display: none; }
.fchip-count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--sand); color: var(--ink); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.fchip.on .fchip-count { background: rgba(251, 248, 242, .22); color: #FBF8F2; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Filter sheet. Olive marks a choice. The page behind stays the warm linen. */
.fsheet {
  position: fixed; inset: 0; z-index: 2400;
  display: flex; align-items: flex-end; justify-content: center;
}
.fsheet[hidden] { display: none; }
.fsheet-backdrop { position: absolute; inset: 0; background: rgba(43, 36, 26, .5); }
.fsheet-panel {
  position: relative; width: min(640px, 100%);
  max-height: min(92vh, 860px); max-height: min(92dvh, 860px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 20px 60px rgba(43, 36, 26, .3);
  transform: translateY(24px); opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.fsheet.open .fsheet-panel { transform: none; opacity: 1; }
.fsheet-head {
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: 12px 12px 10px; border-bottom: 1px solid var(--line); flex: none;
}
.fsheet-head h2 {
  margin: 0; text-align: center; font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
}
.fsheet-x {
  width: 36px; height: 36px; border-radius: 50%; border: 0; justify-self: end;
  background: var(--sand); color: var(--ink); font-size: 22px; line-height: 1; cursor: pointer;
}
.fsheet-x:hover { background: var(--sand-2); }
.fsheet-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fsheet-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 6px 22px 8px; -webkit-overflow-scrolling: touch; }
.fsec { border-bottom: 1px solid var(--line); }
.fsec:last-child { border-bottom: 0; }
.fsec-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 0; background: transparent; cursor: pointer; text-align: left;
  padding: 18px 2px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink);
}
.fsec-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fsec-meta { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.fsec-sum {
  font-size: 13.5px; font-weight: 650; color: var(--accent);
  max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fsec-caret {
  width: 8px; height: 8px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
}
.fsec.is-collapsed .fsec-caret { transform: rotate(-45deg) translateY(2px); }
.fsec.is-collapsed .fsec-body { display: none; }
.fsec-body { padding: 0 2px 22px; }
.fsec-help { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; max-width: 42em; }
.fsec-sub {
  margin: 16px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.fsec-body > .fsec-sub:first-of-type { margin-top: 0; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-btn {
  border: 1.5px solid #C4B49A; background: #FBF8F2; color: var(--ink);
  min-height: 44px; padding: 8px 14px; border-radius: 12px;
  font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; cursor: pointer;
}
.choice-btn:hover { background: #F3EBDD; }
.choice-btn.on { background: var(--accent); border-color: var(--accent); color: #FBF8F2; }
.choice-btn.on:hover { background: #31492C; color: #FBF8F2; }
.choice-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sheet-field {
  display: flex; align-items: center; gap: 8px; width: 100%;
  min-height: 52px; margin-top: 12px; padding: 0 14px;
  background: #FBF8F2; border: 1.5px solid #C4B49A; border-radius: 14px;
}
.sheet-field:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(61, 90, 54, .28); }
.sheet-field.invalid { border-color: var(--clay); box-shadow: 0 0 0 3px rgba(164, 82, 47, .2); }
.sheet-field-label { font-size: 13px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.sheet-affix { font-size: 16px; font-weight: 700; color: var(--ink-2); }
.sheet-input {
  flex: 1; width: 100%; min-width: 0; border: 0; background: transparent;
  color: var(--ink); font: inherit; font-weight: 650; font-size: 16px; padding: 12px 0;
}
.sheet-input:focus { outline: none; }
.sheet-input::placeholder { color: var(--muted); font-weight: 500; }
.sheet-input.date { font-variant-numeric: tabular-nums; }
.range-row { display: flex; align-items: stretch; gap: 8px; }
.range-row .sheet-field { margin-top: 0; flex: 1 1 0; width: auto; min-width: 0; }
.range-to { flex: none; align-self: center; color: var(--muted); font-size: 13px; font-weight: 700; }
.field-error { margin: 8px 2px 0; color: var(--clay); font-size: 13.5px; font-weight: 600; }
.field-error[hidden] { display: none; }
.fsheet-foot {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.fsheet-reset {
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
  min-height: 48px; padding: 8px 4px; font-size: 14.5px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px; white-space: nowrap;
}
.fsheet-reset:hover { color: #1A1815; }
.fsheet-reset:disabled { opacity: .38; cursor: default; text-decoration: none; }
.fsheet-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fsheet-see {
  flex: 1; border: 0; background: var(--accent); color: #FBF8F2; cursor: pointer;
  min-height: 48px; padding: 10px 16px; border-radius: 12px;
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
}
.fsheet-see:hover { background: #31492C; }
.fsheet-see:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.fsheet.is-focus .fsec { display: none; border: 0; }
.fsheet.is-focus .fsec.is-target { display: block; }
.fsheet.is-focus .fsec.is-target .fsec-head { display: none; }
.fsheet.is-focus .fsec.is-target .fsec-body { display: block; padding-top: 16px; }
@media (min-width: 821px) {
  .fsheet { align-items: center; padding: 28px; }
  .fsheet-panel {
    border-radius: 20px; max-height: min(86vh, 820px);
    transform: translateY(12px);
  }
  .fsheet.is-focus .fsheet-panel { width: min(520px, 100%); }
}
@media (max-width: 820px) {
  .fsheet:not(.is-focus) .fsheet-panel {
    height: 100%; max-height: 100%; border-radius: 0; transform: translateY(100%); opacity: 1;
  }
  .fsheet:not(.is-focus).open .fsheet-panel { transform: none; }
  .fsheet:not(.is-focus) .fsheet-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .fsheet.is-focus .fsheet-panel { max-height: 92dvh; transform: translateY(100%); opacity: 1; }
  .fsheet.is-focus.open .fsheet-panel { transform: none; }
}
body.filters-open { overflow: hidden; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 42%; }
.listpane { padding: 22px 28px 108px; min-width: 0; }
.mappane { position: sticky; top: var(--top); height: calc(100vh - var(--top)); padding: 14px 14px 14px 0; }
#mapcanvas { width: 100%; height: 100%; border-radius: 18px; background: #E9E3D7; border: 1px solid var(--line); }

/* Intro */
.intro h1 { font-size: 32px; line-height: 1.12; letter-spacing: -0.025em; font-weight: 650; margin: 0 0 6px; max-width: 18em; }
.intro h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--accent); font-size: 1.12em; letter-spacing: 0; }
.intro .sub { color: var(--ink-2); margin: 0 0 8px; max-width: 42em; font-size: 15px; }
.sample-note {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px;
  margin: 0 0 14px; padding: 10px 12px; max-width: 42em;
  background: var(--sand); border-radius: 14px;
}
.sample-note p { flex: 1 1 16em; margin: 0; color: var(--ink-2); font-size: 14px; }
.sample-signin, .sample-dismiss {
  flex: none; border: 0; cursor: pointer;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 650;
}
.sample-signin:hover, .sample-dismiss:hover { filter: brightness(1.08); }
.sample-signin:focus-visible, .sample-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sample-note[hidden] { display: none; }
html.list-pending .grid, html.list-pending .listbar, html.list-pending .watch, html.list-pending .empty { visibility: hidden; }
.welcome-sample { margin: 10px 0 0; max-width: none; }
.how-note { margin: 0 0 12px; }
.how-note summary {
  cursor: pointer; width: fit-content; color: var(--ink-2);
  font-size: 13.5px; font-weight: 650;
}
.how-note summary:hover { color: var(--ink); }
.how-note summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.how-note p { margin: 8px 0 0; max-width: 38em; color: var(--ink-2); font-size: 14.5px; }
.count-mobile { display: none; }

/* Controls */
.controls { display: flex; gap: 8px; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); min-width: 0; position: relative; }
.listbar { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin: 14px 0 16px; }
.chips { display: flex; flex-wrap: nowrap; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; max-width: 100%; flex: 1 1 auto; }
.chips.can-scroll, .fchips.can-scroll {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.scroll-cue {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 999px;
  background: var(--sand); color: var(--ink); cursor: pointer; font-size: 18px; line-height: 1;
}
.scroll-cue[hidden] { display: none; }
.scroll-cue:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend { margin: 8px 0 0; color: var(--ink-2); font-size: 13.5px; }
.legend summary { cursor: pointer; color: var(--muted); font-weight: 650; min-height: 36px; display: flex; align-items: center; }
.legend ul { margin: 4px 0 8px; padding-left: 18px; }
.legend li { margin: 4px 0; }
.sort-inline {
  flex: none; border: 0; background: var(--sand); color: var(--ink); cursor: pointer;
  min-height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 700;
}
.sort-inline:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--sand-2); background: var(--sand); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.chip:hover { background: var(--sand-2); }
.chip .n { color: var(--muted); margin-left: 4px; font-size: 12.5px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 550; }
.chip.on .n { color: var(--accent); }
.result-line { font-size: 13px; color: var(--muted); margin: 0; }

/* Cards. Photo on the left, price and match on one line, so a list scans without opening each house. */
.grid { display: flex; flex-direction: column; gap: 12px; }
.card {
  cursor: pointer; border-radius: 18px; padding: 10px; outline: none; min-width: 0;
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: 0 2px 4px rgba(74,56,30,.08), 0 10px 24px rgba(74,56,30,.08); }
.card .photo {
  position: relative; width: 100%; min-width: 0; aspect-ratio: 4 / 3;
  border-radius: var(--radius); overflow: hidden; background: var(--sand);
}
.card .photo img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.heart {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(251, 248, 242, .94); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(43, 40, 35, .2);
}
.heart svg { width: 18px; height: 18px; display: block; }
.heart[aria-pressed="true"] { color: var(--accent); }
.heart[aria-pressed="true"] path { fill: currentColor; }
.heart:hover { color: var(--accent); }
.heart:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hide-house {
  align-self: flex-start; margin-top: 4px; border: 0; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 650; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  min-height: 32px; padding: 4px 0;
}
.hide-house:hover { color: var(--ink); }
.hide-house:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Photo carousel: native horizontal scroll with snap. pan-x pan-y keeps vertical page scroll working.
   Slides and images are taken out of flow so a photo's intrinsic size cannot widen a grid column.
   Safari otherwise sizes the column to the file and overflow:hidden leaves only a corner. */
.photo .car {
  position: absolute; inset: 0; display: flex; min-width: 0; min-height: 0;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: auto; overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; scrollbar-width: none;
}
.photo .car::-webkit-scrollbar { display: none; }
.photo .slide {
  position: relative; flex: 0 0 100%; width: 100%; min-width: 0; height: 100%;
  overflow: hidden; scroll-snap-align: start; scroll-snap-stop: always;
}
.photo .slide img {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: center; display: block;
  -webkit-user-drag: none; user-select: none;
}
.photo-fallback {
  display: none; position: absolute; inset: 0; z-index: 1;
  align-items: center; justify-content: center; padding: 8px; text-align: center;
  background: var(--sand); color: var(--muted); font-size: 12px; line-height: 1.3;
  pointer-events: none;
}
.is-broken > img[data-photo] { visibility: hidden; }
.is-broken > .photo-fallback { display: flex; }
.photo .dots { position: absolute; left: 50%; bottom: 11px; z-index: 2; transform: translateX(-50%); display: flex; gap: 5px; pointer-events: none; }
.photo .dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(251,248,242,.55); box-shadow: 0 0 2px rgba(43,40,35,.35); transition: background .15s, transform .15s; }
.photo .dots i.on { background: #FBF8F2; transform: scale(1.15); }
.photo .carr {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); width: 30px; height: 30px; border-radius: 50%;
  border: 0; background: rgba(251,248,242,.92); color: var(--ink); font-size: 20px; line-height: 28px; padding: 0;
  cursor: pointer; box-shadow: 0 1px 4px rgba(43,40,35,.22); opacity: 0; transition: opacity .15s;
}
.photo .carr.prev { left: 10px; }
.photo .carr.next { right: 10px; }
.photo:hover .carr { opacity: .92; }
.photo .carr:hover { opacity: 1; }
.photo.at-start .carr.prev, .photo.at-end .carr.next { visibility: hidden; }
@media (hover: none) { .photo .carr { display: none; } }
.card.selected { box-shadow: 0 0 0 2px var(--ink), var(--shadow); border-color: var(--ink); }
.card:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.score {
  display: inline-flex; align-items: baseline; gap: 4px; flex: none; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; font-weight: 650; line-height: 1.3;
}
.score .word { font-weight: 500; color: var(--ink-2); font-size: 12px; }
.score.score-low { background: #F6E6DA; color: var(--clay); }
.score.score-low .word { color: #8C6239; }
.score.score-neutral {
  background: var(--sand); color: var(--ink-2); font-weight: 600; font-size: 12px;
}
.reason.reason-neutral { color: var(--ink-2); font-weight: 500; white-space: normal; }
.reason.reason-low { color: var(--clay); }
.m-score.score-low { background: #F6E6DA; color: var(--clay); }
.m-score.score-neutral { background: var(--sand); color: var(--ink-2); font-weight: 600; }
.m-reason.reason-neutral { color: var(--ink-2); }
.m-reason.reason-low { color: var(--clay); }
.photo > .score {
  position: absolute; top: 10px; right: 10px; background: var(--surface);
  box-shadow: 0 1px 4px rgba(43,40,35,.18);
}
.pills { position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; max-width: 70%; pointer-events: none; }
.pill.dom { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 600; }
.pill.dom .ico { width: 12px; height: 12px; flex: none; color: var(--muted); }
.pill.dom em { font-style: normal; font-weight: 450; color: var(--muted); margin-left: 2px; }
.pill { background: rgba(251,248,242,.95); color: var(--ink); font-size: 11.5px; font-weight: 550; padding: 3px 8px; border-radius: 999px; box-shadow: 0 1px 3px rgba(43,40,35,.15); white-space: nowrap; }
.pill.today, .pill.owner { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.owner-note { margin: 4px 0 0; font-size: 13px; font-weight: 650; color: var(--accent); }
.owner-note a { color: inherit; }
.pill.drop { color: var(--clay); }
.nphotos { position: absolute; bottom: 10px; right: 10px; z-index: 2; background: rgba(43,40,35,.62); color: #FBF8F2; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; }
.card .info { padding: 2px 6px 2px 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.price-row { min-width: 0; }
.price-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.price-row .price, .sh-info .price { font-weight: 650; letter-spacing: -0.02em; }
.budget-line {
  display: block; margin-top: 1px; font-size: 12px; font-weight: 550; letter-spacing: 0;
  color: var(--ink-2); line-height: 1.3;
}
.unconfirmed-hint { margin: 0 0 6px; font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.price-row .price { font-size: 22px; }
.price-row .price small, .sh-info .price small { font-size: 13px; color: var(--muted); font-weight: 450; letter-spacing: 0; }
.price-unknown { color: var(--ink-2); font-weight: 700; letter-spacing: -0.01em; }
.reason { font-size: 14px; color: var(--accent); margin: 2px 0 6px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.facts { font-size: 14px; color: var(--ink); }
.where { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 48px; overflow: hidden; }
.tag { background: var(--sand); color: var(--ink-2); font-size: 12px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.tag.dom { display: inline-flex; align-items: center; gap: 5px; background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.tag.dom .ico { width: 13px; height: 13px; flex: none; }
.kv .sub { color: var(--muted); font-size: 13px; }
.empty {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  margin: 8px 0 24px; padding: 22px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  color: var(--ink-2); box-shadow: var(--shadow);
}
.empty[hidden] { display: none; }
.empty-title { margin: 0; color: var(--ink); font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.empty p { margin: 0; }
.empty-reset {
  margin-top: 8px; border: 0; background: var(--ink); color: #FBF8F2; cursor: pointer;
  min-height: 44px; padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 700;
}
.empty-reset:hover { background: #1A1815; }
.empty-reset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty-quiet {
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  min-height: 44px; padding: 8px 4px; font-size: 14px; font-weight: 650;
  text-decoration: underline; text-underline-offset: 3px;
}
.empty-quiet:hover { color: var(--ink); }
.empty-quiet:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden-dock {
  margin: 8px 0 24px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow);
}
.hidden-dock[hidden] { display: none; }
.hidden-dock summary {
  cursor: pointer; min-height: 44px; padding: 12px 16px;
  font-weight: 650; color: var(--ink-2);
}
.hidden-dock summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hidden-list { display: flex; flex-direction: column; gap: 4px; padding: 0 12px 12px; }
.hidden-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 4px 4px 8px;
}
.hidden-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.hidden-row button {
  flex: none; border: 0; background: var(--sand); color: var(--ink); cursor: pointer;
  min-height: 44px; padding: 0 14px; border-radius: 999px; font-weight: 650;
}
.hidden-row button:hover { background: var(--sand-2); }
.hidden-row button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toast {
  position: fixed; left: 50%; bottom: calc(78px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1300;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  background: var(--ink); color: #FBF8F2; border-radius: 999px;
  padding: 4px 6px 4px 16px; box-shadow: 0 8px 24px rgba(43, 36, 26, .28);
}
.toast[hidden] { display: none; }
.toast p { margin: 0; font-weight: 650; }
.toast button {
  border: 0; background: transparent; color: #FBF8F2; cursor: pointer;
  font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
  min-height: 44px; padding: 0 12px;
}
.toast button:focus-visible { outline: 2px solid #FBF8F2; outline-offset: 2px; }

/* Floating Map | Sort pill. Stays put while the list scrolls. */
.floatdock {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1100;
  display: flex; flex-direction: column; align-items: center;
}
.floatpill {
  display: flex; align-items: stretch;
  background: var(--ink); color: #FBF8F2; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(43, 36, 26, .28);
}
.float-btn {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px; padding: 0 18px;
  font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
}
.float-btn:first-child { border-radius: 999px 0 0 999px; }
.float-btn:last-child { border-radius: 0 999px 999px 0; }
.float-btn:hover { background: rgba(251, 248, 242, .08); }
.float-btn:focus-visible { outline: 2px solid #FBF8F2; outline-offset: -3px; }
.float-btn[aria-expanded="true"] { background: rgba(251, 248, 242, .12); }
.float-ico { width: 16px; height: 16px; flex: none; }
.float-ico[hidden] { display: none; }
.float-rule { width: 1px; background: rgba(251, 248, 242, .28); margin: 12px 0; }
.sortmenu {
  position: static; min-width: 0; width: min(320px, 100%); margin: 0 0 12px;
  padding: 6px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.sortmenu[hidden] { display: none; }
.sort-opt {
  width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
  min-height: 44px; padding: 8px 12px; border-radius: 12px; text-align: left;
  font-size: 15px; font-weight: 650;
}
.sort-opt:hover { background: var(--sand); }
.sort-opt.active { background: var(--accent-soft); color: var(--accent); }
.sort-hint { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.sort-opt.active .sort-hint { color: var(--accent); }
.sort-opt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.modal-open .floatdock, body.filters-open .floatdock, body.house-sheet .floatdock { visibility: hidden; }

/* Status watch */
.watch { margin-top: 56px; border-top: 1px solid var(--line); padding-top: 20px; }
.watch[hidden] { display: none; }
.watch summary { cursor: pointer; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.watch summary::-webkit-details-marker { display: none; }
.watch-title { font-weight: 600; font-size: 17px; }
.watch-sub { font-size: 13.5px; color: var(--muted); }
.watch .grid { margin-top: 22px; }
.watch .card .photo img { filter: saturate(.6) sepia(.1); }

/* How it works */
.howto { margin-top: 56px; border-top: 1px solid var(--line); padding-top: 24px; color: var(--ink-2); font-size: 14px; }
.howto h2 { font-size: 17px; margin: 0 0 10px; color: var(--ink); }
.rules { padding-left: 18px; margin: 0 0 12px; max-width: 75ch; }
.rules li { margin: 4px 0; }
.fine { color: var(--muted); font-size: 13px; max-width: 75ch; }
.brandline { margin-top: 22px; font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.brandline .muted { font-weight: 400; }
.brandline a { color: inherit; text-underline-offset: 2px; }

/* Map pins */
.pin-wrap { background: none; border: 0; }
.ppin {
  display: inline-block; transform: translate(-50%, -50%); background: var(--surface); color: var(--ink);
  font: 600 11.5px/1 var(--font); padding: 5px 7px; border-radius: 999px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(43,40,35,.28); border: 1px solid var(--sand-2); cursor: pointer;
}
.ppin.approx {
  background: var(--sand); color: var(--ink-2);
  border: 1.5px dashed var(--ink-2); font-style: italic;
}
.ppin.approx::before { content: "~"; font-style: normal; margin-right: 1px; }
.ppin.over { box-shadow: 0 1px 4px rgba(43,40,35,.28), inset 0 -3px 0 #8C6239; }
.ppin.watch { color: var(--muted); background: var(--sand); }
.ppin.active, .ppin:hover { background: var(--ink); color: #FBF8F2; border-color: var(--ink); }
.ppin.approx.active, .ppin.approx:hover { border-style: dashed; }
.ppin.over.active, .ppin.over:hover { box-shadow: 0 1px 4px rgba(43,40,35,.28), inset 0 -3px 0 #E2C2A4; }
.ppin.active { transform: translate(-50%, -50%) scale(1.12); }
.budget-key {
  position: absolute; z-index: 800; top: 40px; left: 28px; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 10px; font-size: 12.5px; font-weight: 650;
  box-shadow: var(--shadow);
}
.budget-key .swatch {
  width: 14px; height: 10px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--sand-2); box-shadow: inset 0 -3px 0 #8C6239;
}
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content { margin: 10px 12px; font-family: var(--font); }
.pop { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.pop-photo { position: relative; width: 72px; height: 54px; flex: none; border-radius: 8px; overflow: hidden; background: var(--sand); }
.pop-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pop-photo .photo-fallback { font-size: 9px; padding: 4px; }
.pop b { font-size: 14px; display: block; }
.pop .s { color: var(--accent); font-weight: 600; font-size: 12.5px; }
.pop .a { color: var(--muted); font-size: 12.5px; }
.pop .budget-line { margin-top: 2px; }
.pop-approx {
  display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 650; color: var(--ink-2);
  background: var(--sand); border-radius: 999px; padding: 1px 8px;
}
.pop button { margin-top: 4px; border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline; cursor: pointer; font-size: 12.5px; }
.pop-photo .heart { width: 28px; height: 28px; top: 2px; right: 2px; }
.pop-photo .heart svg { width: 14px; height: 14px; }
.pop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; }
.pop-actions button { margin-top: 0; min-height: 32px; }
.pop-actions .hide-house { margin-top: 0; font-size: 12.5px; color: var(--muted); }
.leaflet-container { font-family: var(--font); }
.leaflet-tile-pane { filter: sepia(.08) saturate(.72) brightness(1.03) contrast(.94); }
.leaflet-control-zoom a, .leaflet-control-attribution { background: rgba(251,248,242,.92) !important; color: var(--ink-2) !important; }

/* Map toggle (mobile) */

/* Modal */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(43,36,26,.5); }
.modal-card { position: relative; background: var(--surface); border-radius: 20px; width: min(1040px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(43,36,26,.3); }
.modal-body { overflow: auto; -webkit-overflow-scrolling: touch; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 3; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(43,40,35,.25); font-size: 22px; line-height: 1; cursor: pointer; }
.m-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; padding: 24px 64px 28px 28px; }
.gallery .main { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--sand); }
.gallery .main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gnav { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(251,248,242,.94); color: var(--ink); box-shadow: 0 1px 4px rgba(43,40,35,.25); cursor: pointer; font-size: 18px; }
.gnav.prev { left: 10px; } .gnav.next { right: 10px; }
.gcount { position: absolute; bottom: 10px; right: 10px; background: rgba(43,40,35,.62); color: #FBF8F2; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumb { position: relative; width: 84px; height: 63px; flex: none; border-radius: 8px; overflow: hidden; background: var(--sand); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; opacity: .65; display: block; }
.thumbs img.on { opacity: 1; }
.thumb:has(img.on) { box-shadow: inset 0 0 0 2px var(--ink); }
.thumb.is-broken::after {
  content: "No photo"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 10px; text-align: center; padding: 4px;
}
.m-side h2 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.m-side h2 small { font-size: 15px; color: var(--muted); font-weight: 450; }
.m-score { display: inline-flex; align-items: baseline; gap: 6px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 12px; font-weight: 650; font-size: 15px; margin-bottom: 10px; }
.m-reason { color: var(--accent); font-weight: 500; margin: 2px 0 8px; }
.m-addr { color: var(--muted); margin: 4px 0 14px; }
.m-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.m-pills .pill { box-shadow: none; background: var(--sand); }
.btn { display: inline-block; background: var(--accent); color: #FBF8F2; text-decoration: none; padding: 10px 16px; border-radius: 10px; font-weight: 550; font-size: 14px; }
.src { font-size: 12.5px; color: var(--muted); margin-top: 8px; word-break: break-all; }
.src .full { display: block; font-size: 11.5px; margin-top: 2px; opacity: .8; }
.src a { color: var(--muted); }
.m-sec { margin-top: 22px; }
.m-sec h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.bd { width: 100%; border-collapse: collapse; font-size: 14px; }
.bd td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.bd td.pts { text-align: right; white-space: nowrap; width: 60px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bd tr.total td { font-weight: 650; border-bottom: 0; color: var(--accent); }
.bd tr.start td { color: var(--muted); }
.notes { font-size: 14px; color: var(--ink-2); }
.notes p { margin: 0 0 8px; }
.dnote { font-size: 13px; background: var(--sand); border-radius: 10px; padding: 8px 12px; color: var(--ink-2); }
.m-full { padding: 0 28px 28px; }

/* Tablet */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 38%; }
  .listpane { padding: 28px 24px 56px; }
  .intro h1 { font-size: 30px; }
}

/* Map mode (List | Map toggle), all widths */
body.mode-map { overflow: hidden; }
body.mode-map .layout { display: block; }
body.mode-map .listpane { padding-bottom: 0; }
body.mode-map .mappane { display: block; position: fixed; top: var(--maptop, var(--top)); left: 0; right: 0; bottom: 0; height: auto; padding: 0 14px 14px; z-index: 900; background: var(--bg); }
body.mode-map .intro, body.mode-map .grid, body.mode-map .watch, body.mode-map .hidden-dock, body.mode-map .howto { display: none !important; }
body.mode-map .empty:not([hidden]) {
  display: flex; position: fixed; z-index: 950;
  left: 16px; right: 16px; top: calc(var(--maptop, var(--top)) + 12px);
  width: min(28em, calc(100% - 32px)); margin: 0;
}
body.mode-map .listbar { margin-bottom: 0; }
/* Bottom sheet for the selected pin */
.sheet {
  display: block; position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 1200;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 12px 10px;
  box-shadow: 0 10px 34px rgba(43,36,26,.28); transform: translateY(calc(100% + 24px)); transition: transform .22s ease;
  touch-action: none; cursor: pointer;
}
.sheet[hidden] { display: none; }
.sheet.open { transform: none; }
.sheet .grab { width: 38px; height: 4px; border-radius: 4px; background: var(--sand-2); margin: 2px auto 8px; }
.sh-row { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; align-items: start; }
.sh-photo { position: relative; height: 104px; border-radius: 12px; overflow: hidden; background: var(--sand); }
.sh-photo .score { top: 6px; right: 6px; left: auto; padding: 2px 7px; font-size: 12px; }
.sh-photo .score .word { display: none; }
.sh-photo .dots { bottom: 7px; }
.sh-info { min-width: 0; }
.sh-info .price-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.sh-info .unconfirmed-hint { margin: 0 0 2px; }
.sh-info .price { font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.sh-info .score { padding: 2px 8px; font-size: 12.5px; }
.sh-info .reason { margin: 1px 0 3px; font-size: 13.5px; }
.sh-info .facts, .sh-info .where { font-size: 13px; }
.sh-info .tags { margin-top: 6px; }
.sh-nav { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.sh-nav button { font: inherit; cursor: pointer; }
.sh-prev, .sh-next { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--sand-2); background: var(--surface); color: var(--ink); font-size: 20px; line-height: 28px; padding: 0; }
.sh-prev:disabled, .sh-next:disabled { opacity: .35; }
.sh-pos { font-size: 12.5px; color: var(--muted); }
.sh-open { margin-left: auto; border: 0; background: var(--accent); color: #FBF8F2; padding: 8px 14px; border-radius: 999px; font-weight: 600; font-size: 13.5px; }
@media (min-width: 821px) {
  .floatdock { display: none; }
  body.mode-map .floatdock { display: flex; }
  body.mode-map .mappane { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .sheet { left: 28px; right: auto; bottom: 28px; width: 460px; }
  .sheet .grab { display: none; }
  .sheet .sh-row { grid-template-columns: 150px minmax(0, 1fr); }
  .sheet .sh-photo { height: 116px; }
}

/* Phone. Chips stay one short row so the first house is on screen. */
@media (max-width: 820px) {
  :root { --top: 108px; }
  .topbar-main { padding: 0 10px; gap: 6px; min-height: 48px; min-width: 0; }
  .brand { min-width: 0; }
  .brand .name { font-size: 15px; }
  .brand .note { display: none; }
  .fchips { padding: 8px 12px 10px; }
  .fchip { min-height: 44px; padding: 0 12px; }
  .fsheet-scroll { padding: 4px 16px 8px; }
  .fsheet-foot { padding-left: 14px; padding-right: 14px; }
  .choice-btn { min-height: 48px; }
  .range-row { gap: 6px; }
  .range-row .sheet-field { min-height: 52px; padding: 0 10px; }
  .range-row .sheet-field-label { font-size: 12px; }
  .card { grid-template-columns: 112px minmax(0, 1fr); gap: 10px; padding: 8px; }
  .heart { width: 44px; height: 44px; top: 4px; right: 4px; }
  .heart svg { width: 20px; height: 20px; }
  .hide-house { min-height: 44px; padding: 8px 0; }
  .pop-actions button { min-height: 44px; }
  .card .nphotos { display: none; }
  .card .photo { aspect-ratio: 1; }
  .price-row .price { font-size: 18px; }
  .card .tags { flex-wrap: nowrap; max-height: 26px; }
  .count { display: none; }
  .account { margin-left: auto; }
  .topbar-main { flex-wrap: wrap; row-gap: 6px; padding-top: 6px; padding-bottom: 6px; }
  .cities { order: 3; margin-left: 0; flex: 1 0 100%; overflow-x: auto; }
  .city { padding: 4px 8px; font-size: 12.5px; }
  .city .soon { display: none; }
  .layout { display: block; }
  .listpane { padding: 8px 16px calc(132px + env(safe-area-inset-bottom)); }
  .sort-inline { display: none; }
  body.header-compact .cities { display: none; }
  body.header-compact .topbar-main { min-height: 40px; padding-top: 2px; padding-bottom: 2px; }
  body.header-compact .fchips { padding-top: 4px; padding-bottom: 4px; }
  body.header-compact .fchip { min-height: 36px; }
  body.mode-map .cities,
  body.mode-map .controls,
  body.mode-map .legend,
  body.mode-map .listbar,
  body.mode-map .sortmenu { display: none !important; }
  body.mode-map .mappane { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .intro h1 { font-size: 26px; margin-bottom: 4px; }
  .intro .sub { font-size: 14.5px; line-height: 1.35; margin-bottom: 6px; }
  .count-mobile { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
  .controls { align-items: stretch; gap: 8px; padding-bottom: 4px; }
  .listbar { align-items: flex-start; margin: 6px 0 8px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; min-width: 0; max-width: calc(100% + 32px); }
  .chips::-webkit-scrollbar { display: none; }
  .grid { gap: 10px; }
  .float-btn { padding: 0 16px; }
  .mappane { display: none; }
  .viewswitch { margin-right: 8px; }
  .viewswitch-btn { width: 44px; height: 40px; }
  body.mode-map .mappane { padding: 0; border-top: 1px solid var(--line); }
  body.mode-map .budget-key { top: 12px; left: 12px; }
  .sample-note { margin-bottom: 10px; padding: 8px 10px; }
  .sample-note p { font-size: 13.5px; }
  body.mode-map #mapcanvas { border-radius: 0; border: 0; }
  .modal { padding: 0; align-items: stretch; }
  .modal-card { border-radius: 0; max-height: none; height: 100%; }
  .modal-close { top: 10px; right: 10px; background: rgba(251,248,242,.95); }
  .m-grid { grid-template-columns: 1fr; padding: 12px 16px 20px; gap: 18px; }
  .m-side { padding-top: 0; }
  .m-full { padding: 0 16px 24px; }
  .gallery .main { border-radius: 12px; }
  .kv { grid-template-columns: 96px 1fr; }
}
/* Grid layout: the map sits at the top and scrolls away with the page.
   It is not pinned, so cards never slide under it. */
html.layout-grid body:not(.mode-map) .layout {
  display: flex; flex-direction: column;
}
html.layout-grid body:not(.mode-map) .mappane {
  order: -1; position: relative; top: auto; z-index: auto;
  display: flex; flex-direction: column;
  height: 38vh; height: 38dvh; min-height: 220px; max-height: 420px;
  width: auto; padding: 12px 16px 8px;
  background: var(--bg);
  box-shadow: none;
}
html.layout-grid body:not(.mode-map) #mapcanvas { flex: 1 1 auto; height: auto; min-height: 0; }
html.layout-grid body:not(.mode-map) .budget-key { top: 22px; left: 28px; }
html.layout-grid body:not(.mode-map) .listpane { padding-top: 8px; }
html.layout-grid body:not(.mode-map) .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  gap: 14px;
}
html.layout-grid body:not(.mode-map) .grid > .card { min-width: 0; max-width: 100%; }
html.layout-grid body:not(.mode-map) .card {
  grid-template-columns: minmax(0, 1fr); align-items: stretch; gap: 10px;
  scroll-margin-top: calc(var(--top) + 12px);
  scroll-margin-bottom: 96px;
}
html.layout-grid body:not(.mode-map) .card .photo {
  width: 100%; min-width: 0; aspect-ratio: 3 / 2; height: auto;
}
html.layout-grid body:not(.mode-map) .card .info { padding: 2px 4px 6px; }
html.layout-grid body:not(.mode-map) .card .tags { max-height: none; }

/* Phone grid rules come after the desktop ones so the short map and the
   compact card actually win. */
@media (max-width: 820px) {
  html.layout-grid body:not(.mode-map) .mappane {
    display: flex;
    height: 26vh; height: 26dvh; min-height: 140px; max-height: 180px;
    padding: 0 8px 6px;
  }
  html.layout-grid body:not(.mode-map) .intro h1 { font-size: 22px; margin-bottom: 2px; }
  html.layout-grid body:not(.mode-map) .intro .sub,
  html.layout-grid body:not(.mode-map) .count-mobile { display: none; }
  html.layout-grid body:not(.mode-map) .how-note { margin-bottom: 4px; }
  html.layout-grid body:not(.mode-map) .listbar { margin: 4px 0 8px; }
  html.layout-grid body:not(.mode-map) .grid { grid-template-columns: minmax(0, 1fr); }
  html.layout-grid body:not(.mode-map) .card {
    grid-template-columns: minmax(0, 1fr); gap: 10px;
    scroll-margin-top: calc(var(--top) + 8px);
  }
  html.layout-grid body:not(.mode-map) .card .photo {
    aspect-ratio: 3 / 2; width: 100%; min-width: 0; height: auto;
  }
  html.layout-grid body:not(.mode-map) .card .info { padding: 2px 4px 6px; }
  html.layout-grid body:not(.mode-map) .card .nphotos { display: inline; }
}

html.welcome-pending, html.welcome-pending body { overflow: hidden; }
html.welcome-pending .layout, html.welcome-pending .floatdock, html.welcome-pending .filterbar { visibility: hidden; }
.welcome {
  position: fixed; left: 0; right: 0; bottom: 0; top: 64px; z-index: 2300;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
  background: rgba(43, 36, 26, .45);
}
.welcome[hidden] { display: none; }
.welcome-card {
  width: min(520px, 100%);
  max-height: 100%;
  overflow: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 22px 18px 16px;
  box-shadow: 0 20px 50px rgba(43, 36, 26, .28);
}
.welcome-card h2 {
  margin: 0 0 8px; font-size: 26px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 650;
}
.welcome-card h2:focus { outline: none; }
.welcome-card > p { margin: 0 0 4px; color: var(--ink-2); }
.welcome-label {
  margin: 14px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.welcome .range-row { margin-bottom: 2px; }
.welcome .field-error { margin-top: 10px; }
.welcome a.choice-btn { display: inline-flex; align-items: center; text-decoration: none; }
.welcome-save { margin: 14px 0 0; color: var(--accent); font-weight: 650; }
.welcome-save[hidden] { display: none; }
.welcome-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; }
.welcome-go {
  border: 0; background: var(--accent); color: #FBF8F2; cursor: pointer;
  min-height: 48px; border-radius: 12px; font-size: 16px; font-weight: 700;
}
.welcome-go:hover { background: #31492C; }
.welcome-go:focus-visible, .welcome-skip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.welcome-skip {
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
  min-height: 44px; font-size: 14.5px; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
}
@media (min-width: 821px) {
  .welcome { align-items: center; padding: 24px; }
  .welcome-card { border-radius: 20px; padding: 28px 24px 18px; }
}
@media (max-width: 820px) {
  .intro .sub { margin-bottom: 6px; }
  .how-note { margin-bottom: 8px; }
  .how-note p { font-size: 14px; }
}

@media (max-width: 340px) {
  .topbar-main { flex-wrap: wrap; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .brand { flex: 1 0 auto; min-width: max-content; }
  .account { margin-left: 0; }
  .cities { order: 3; margin-left: 0; flex: 1 0 100%; }
}
