/* ===========================================================
   Homing — warm coastal palette, refined-but-bohemian.
   =========================================================== */

:root {
  --bg:           #f8f4ed;         /* warm off-white / sand */
  --bg-panel:     #ffffff;
  --bg-muted:     #f1ebe0;
  --ink:          #1f1a15;         /* near-black ink */
  --ink-soft:     #4a4238;
  --ink-mute:     #8a7f72;
  --line:         #e6dfd2;
  --line-soft:    #efe9dc;
  --accent:       #c86b4e;         /* soft coral / terracotta */
  --accent-deep:  #9e4a31;
  --sea:          #6b9a9a;         /* muted seafoam */
  --sea-deep:     #4a7878;
  --gold:         #c69a5c;
  --good:         #5b8f5d;         /* preferred (green) */
  --good-fill:    rgba(91, 143, 93, 0.28);
  --bad:          #b95050;         /* avoid (red) */
  --bad-fill:     rgba(185, 80, 80, 0.28);
  --neutral-fill: rgba(0, 0, 0, 0.04);
  --shadow-sm:    0 1px 2px rgba(31, 26, 21, 0.06);
  --shadow-md:    0 6px 24px rgba(31, 26, 21, 0.08);
  --radius:       10px;
  --radius-lg:    16px;

  --serif: 'Newsreader', Georgia, serif;
  --sans:  'Source Sans 3', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 28px 40px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.header .brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.brand h1 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  margin: 0;
}
.brand .tag {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 14px;
}
.user-chip img {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.user-chip button {
  background: none;
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 13px;
}
.user-chip button:hover { border-color: var(--ink-soft); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 40px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.tabs button {
  background: none;
  border: none;
  padding: 16px 22px;
  font-family: var(--serif);
  font-size: 19px;
  color: var(--ink-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tabs button:hover { color: var(--ink-soft); }
.tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- Layout ---------- */
.city-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  flex: 1;
  min-height: 0;
}
.map-wrap {
  position: relative;
  min-height: 620px;
}
#map, .map-el {
  position: absolute;
  inset: 0;
}
.map-hint {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
  max-width: 320px;
}
.map-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
}
.map-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-btn:hover { border-color: var(--ink-mute); }
.map-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Side panel ---------- */
.side {
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 22px 22px 40px;
}
.side h2 {
  font-size: 22px;
  margin: 0 0 4px;
}
.side .city-sub {
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line-soft);
}
.section h3 {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.section .hint {
  font-size: 13px;
  color: var(--ink-mute);
  margin-bottom: 12px;
}

/* ---------- Tag list ---------- */
.tag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-muted);
  font-size: 14px;
}
.tag-row.good { background: var(--good-fill); }
.tag-row.bad  { background: var(--bad-fill); }
.tag-row .nm  { font-family: var(--serif); font-size: 15px; }
.tag-row .bd  { font-size: 12px; color: var(--ink-mute); }
.tag-row .rm  { background: none; border: none; color: var(--ink-mute); font-size: 12px; }
.tag-row .rm:hover { color: var(--accent-deep); }

/* ---------- Listings ---------- */
.listing {
  background: var(--bg-muted);
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  position: relative;
}
.listing .price {
  font-family: var(--serif);
  font-size: 18px;
  color: var(--ink);
}
.listing .beds {
  font-size: 12px;
  color: var(--ink-mute);
  margin-left: 6px;
}
.listing .url a {
  font-size: 12px;
  color: var(--sea-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  white-space: nowrap;
}
.listing .notes {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.listing .del {
  position: absolute;
  top: 8px; right: 8px;
  background: none; border: none;
  color: var(--ink-mute);
  font-size: 12px;
}
.listing .del:hover { color: var(--accent-deep); }

.listing-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.listing-form input, .listing-form textarea {
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.listing-form textarea {
  grid-column: 1 / -1;
  min-height: 48px;
  resize: vertical;
}
.listing-form input.full { grid-column: 1 / -1; }
.listing-form button {
  grid-column: 1 / -1;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 500;
}
.listing-form button:hover { background: var(--accent-deep); }

/* ---------- News ---------- */
.news-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.news-item:last-child { border: none; }
.news-item .src { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.05em; }
.news-empty { font-size: 13px; color: var(--ink-mute); font-style: italic; }

/* ---------- Compare ---------- */
.compare-wrap {
  padding: 32px 40px;
  overflow-x: auto;
}
.compare-wrap h2 {
  font-size: 28px;
  margin-bottom: 6px;
}
.compare-wrap .sub {
  color: var(--ink-mute);
  margin-bottom: 24px;
}
.compare-table {
  min-width: 800px;
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.compare-table th, .compare-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  font-size: 14px;
}
.compare-table th.row-label {
  background: var(--bg-muted);
  font-weight: 600;
  color: var(--ink-soft);
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 12px;
  width: 160px;
}
.compare-table thead th {
  background: var(--bg-muted);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
}
.compare-table thead th .city-label {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.compare-empty {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--ink-mute);
  font-family: var(--serif);
  font-size: 18px;
}

/* ---------- Login gate ---------- */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(200, 107, 78, 0.08), transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(107, 154, 154, 0.10), transparent 70%),
    var(--bg);
  padding: 40px 20px;
}
.gate-card {
  max-width: 440px;
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.gate-card h1 {
  font-family: var(--serif);
  font-size: 34px;
  margin-bottom: 6px;
}
.gate-card .sub {
  color: var(--ink-mute);
  margin-bottom: 28px;
  font-size: 15px;
}
#g_id_signin { display: inline-block; }
.gate-note {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 20px;
}

/* ---------- Mapbox polygon popup ---------- */
.mapboxgl-popup-content {
  font-family: var(--sans);
  padding: 10px 14px 12px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--line);
}
.popup-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 2px;
}
.popup-desc {
  font-size: 12px;
  color: var(--ink-mute);
  margin-bottom: 8px;
  max-width: 260px;
}
.popup-btns { display: flex; gap: 6px; }
.popup-btns button {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  color: var(--ink-soft);
  font-family: var(--sans);
}
.popup-btns button:hover { border-color: var(--ink-mute); }
.popup-btns button.good { border-color: var(--good); color: var(--good); }
.popup-btns button.bad  { border-color: var(--bad); color: var(--bad); }
.popup-btns button.good:hover { background: var(--good); color: #fff; }
.popup-btns button.bad:hover  { background: var(--bad); color: #fff; }

/* ---------- Marker popups ---------- */
.marker-popup {
  font-family: var(--sans);
}
.marker-popup .mp-label { font-family: var(--serif); font-size: 15px; margin-bottom: 4px; }
.marker-popup .mp-del {
  font-size: 12px; background: none; border: none; color: var(--accent-deep); padding: 0;
}

.custom-marker {
  width: 40px;
  height: 52px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 52'><path d='M20 0C9 0 0 9 0 20c0 15 20 32 20 32s20-17 20-32C40 9 31 0 20 0z' fill='%23127ee8' stroke='%23ffffff' stroke-width='2.5'/><circle cx='20' cy='20' r='7' fill='%23ffffff'/></svg>") no-repeat center;
  background-size: contain;
  cursor: pointer;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35));
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .city-layout { grid-template-columns: 1fr; }
  .side { border-left: none; border-top: 1px solid var(--line); max-height: 60vh; }
  .map-wrap { min-height: 460px; }
  .header { padding: 20px 20px 12px; }
  .tabs { padding: 0 12px; overflow-x: auto; }
  .tabs button { padding: 14px 14px; font-size: 17px; white-space: nowrap; }
  .compare-wrap { padding: 24px 20px; }
  .brand h1 { font-size: 24px; }
}

/* Logo */
.gate-logo {
  width: 96px;
  height: 96px;
  display: block;
  margin: 0 auto 20px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.header-logo {
  height: 1.5em;
  width: auto;
  vertical-align: -0.22em;
  border-radius: 6px;
  margin-right: 12px;
}
.brand h1 { line-height: 1; display: inline-flex; align-items: center; gap: 0; }
.brand { display: flex; align-items: baseline; gap: 14px; }
.brand h1 { margin: 0; }
.brand .tag {
  align-self: baseline;
  position: relative;
  top: -4px; /* nudge up to visually align with serif baseline */
}

/* Sortable compare table */
.compare-table-flipped th.sortable {
  cursor: pointer;
  user-select: none;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #d9d2c6;
  font-weight: 600;
  color: #4a4238;
  transition: background 120ms ease;
}
.compare-table-flipped th.sortable:hover {
  background: #f0ebe0;
}
.compare-table-flipped th.sorted {
  background: #ede6d7;
  color: #2a241d;
}
.compare-table-flipped tbody tr:hover {
  background: #fdfbf5;
}
.compare-table-flipped td {
  padding: 10px 12px;
  border-bottom: 1px solid #ece6d6;
}

/* Map style toggle */
.map-style-toggle {
  display: inline-flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  margin-right: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}
.map-style-toggle .map-btn {
  border-radius: 0;
  margin: 0;
  padding: 8px 14px;
  min-width: 78px;
  border: none;
}
.map-style-toggle .map-btn + .map-btn {
  border-left: 1px solid rgba(0,0,0,0.1);
}
.map-style-toggle .map-btn.active {
  background: #4a4238;
  color: #f8f4ed;
}

/* Neighborhood list row actions + hide */
.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.hide-btn {
  background: transparent;
  border: 1px solid #d9d2c6;
  color: #7a7164;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  transition: all 120ms ease;
}
.hide-btn:hover {
  background: #e8e1d3;
  color: #4a4238;
  border-color: #b8ae9e;
}
.hidden-section {
  margin-top: 14px;
  border-top: 1px dashed #d9d2c6;
  padding-top: 10px;
}
.link-btn {
  background: transparent;
  border: none;
  color: #7a7164;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.link-btn:hover { color: #4a4238; }
.hidden-list .tag-row {
  opacity: 0.65;
  background: #f4efdf;
}
.hidden-row .nm { font-size: 13px; }

/* Pin search overlay */
.pin-search {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 5;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  overflow: hidden;
}
.pin-search input {
  width: 100%;
  border: none;
  padding: 14px 16px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  background: #fff;
  color: #2a241d;
  box-sizing: border-box;
}
.pin-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid #ece6d6;
}
.pin-search-results li {
  padding: 10px 16px;
  border-bottom: 1px solid #f1ebdc;
  cursor: pointer;
  transition: background 120ms ease;
}
.pin-search-results li:last-child { border-bottom: none; }
.pin-search-results li:hover { background: #fbf7eb; }
.pin-search-results .ps-name {
  font-weight: 600;
  color: #2a241d;
  font-size: 14px;
}
.pin-search-results .ps-place {
  font-size: 12px;
  color: #7a7164;
  margin-top: 2px;
}

/* Collapsible sections */
.section-head {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: #2a241d;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 120ms ease;
}
.section-head:hover { color: #4a4238; }
.section-chevron {
  font-size: 10px;
  color: #9e9483;
  width: 10px;
  display: inline-block;
}
.section-badge {
  margin-left: auto;
  background: #e8e1d3;
  color: #7a7164;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.section.collapsed .section-head {
  padding-bottom: 10px;
}
.section-body {
  animation: slideDown 140ms ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Clickable rows */
.tag-row.clickable {
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}
.tag-row.clickable:hover {
  background: #fbf7eb;
  transform: translateX(2px);
}
.tag-row.clickable.good:hover { background: #e8f2e4; }
.tag-row.clickable.bad:hover { background: #f4e0e0; }

/* Highlighted custom marker on hover */
.custom-marker.hovered {
  z-index: 100;
  filter: drop-shadow(0 0 8px rgba(245, 197, 66, 0.9)) drop-shadow(0 0 16px rgba(245, 197, 66, 0.5));
  transform: scale(1.3);
  transition: transform 120ms ease, filter 120ms ease;
}
.custom-marker {
  transition: transform 120ms ease, filter 120ms ease;
}

/* Ensure custom pin markers sit above everything on the map */
.mapboxgl-marker {
  z-index: 10;
}
.mapboxgl-marker .custom-marker {
  will-change: transform;
}

/* Info button in neighborhood rows */
.info-btn {
  background: transparent;
  border: 1px solid #d9d2c6;
  color: #7a7164;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: all 120ms ease;
  font-family: inherit;
}
.info-btn:hover {
  background: #e8f0f9;
  color: #127ee8;
  border-color: #127ee8;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.55);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fadeIn 140ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fbf7eb;
  border-radius: 16px;
  max-width: 680px;
  width: 100%;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  position: relative;
  animation: slideUp 200ms ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255,255,255,0.95);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: #2a241d;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  transition: transform 120ms ease;
}
.modal-close:hover { transform: scale(1.1); }

.modal-hero {
  width: 100%;
  height: 260px;
  background-color: #e8e1d3;
  background-size: cover;
  background-position: center;
  position: relative;
}
.modal-hero-empty {
  background: linear-gradient(135deg, #e8e1d3 0%, #d9d2c6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-hero-empty-label {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  color: #7a7164;
  letter-spacing: 0.02em;
}
.modal-hero-credit {
  position: absolute;
  bottom: 8px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

.modal-body { padding: 24px 28px 28px; }
.modal-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.modal-title-row h2 {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  margin: 0;
  color: #2a241d;
}

.fit-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fit-strong { background: #c8e6c9; color: #1b5e20; }
.fit-good { background: #dcedc8; color: #33691e; }
.fit-mixed { background: #fff9c4; color: #827717; }
.fit-poor { background: #ffcdd2; color: #b71c1c; }
.fit-unknown { background: #e0e0e0; color: #616161; }

.modal-summary {
  font-size: 15px;
  line-height: 1.6;
  color: #2a241d;
  margin: 18px 0;
  white-space: pre-wrap;
}

.modal-excerpts h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: #7a7164;
  letter-spacing: 0.06em;
  margin: 24px 0 8px;
  font-weight: 600;
}
.modal-excerpt {
  background: #fff;
  border-left: 3px solid #c9a441;
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 0 8px 8px 0;
}
.modal-excerpt p {
  margin: 0 0 6px;
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: #4a4238;
}
.modal-excerpt cite {
  font-size: 12px;
  color: #7a7164;
  font-style: normal;
}
.modal-excerpt cite a {
  color: #127ee8;
  text-decoration: none;
}
.modal-excerpt cite a:hover { text-decoration: underline; }

.modal-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #e8e1d3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.modal-gen-time {
  font-size: 12px;
  color: #9e9483;
}
.modal-regen {
  background: transparent;
  border: 1px solid #d9d2c6;
  color: #4a4238;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 120ms ease;
}
.modal-regen:hover:not(:disabled) {
  background: #4a4238;
  color: #fbf7eb;
  border-color: #4a4238;
}
.modal-regen:disabled { opacity: 0.6; cursor: default; }

.modal-loading {
  padding: 20px;
  text-align: center;
  color: #7a7164;
  font-size: 14px;
  font-style: italic;
}
.modal-error {
  background: #ffe8e8;
  color: #8b2e2e;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin: 12px 0;
}

/* Hero photo action buttons (upload/replace/remove) */
.modal-hero-photo-actions {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.hero-photo-btn {
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(4px);
  font-family: inherit;
  transition: all 120ms ease;
}
.hero-photo-btn:hover:not(:disabled) {
  background: rgba(0,0,0,0.85);
  border-color: rgba(255,255,255,0.6);
}
.hero-photo-btn:disabled { opacity: 0.6; cursor: default; }
.hero-photo-btn.danger { background: rgba(139, 46, 46, 0.7); }
.hero-photo-btn.danger:hover:not(:disabled) { background: rgba(139, 46, 46, 0.95); }
.modal-hero-upload-cta {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
}

/* ==========================================
   HOMES VIEW - listing search
   ========================================== */
.homes-view {
  padding: 20px 28px 40px;
  max-width: 1400px;
  margin: 0 auto;
}

.homes-toolbar {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.homes-toolbar-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.seg {
  display: inline-flex;
  background: #f2ecde;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: #7a7164;
  cursor: pointer;
  font-weight: 500;
  transition: all 120ms ease;
}
.seg-btn:hover { color: #2a241d; }
.seg-btn.active {
  background: #fff;
  color: #2a241d;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.homes-search-btn {
  margin-left: auto;
  background: #127ee8;
  color: #fff;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.homes-search-btn:hover:not(:disabled) { background: #0e6bc8; }
.homes-search-btn:disabled { opacity: 0.6; cursor: default; }

.homes-criteria {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid #f0e8d8;
}
.crit {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
}
.crit span {
  font-size: 11px;
  color: #7a7164;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.crit input {
  border: 1px solid #d9d2c6;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fbf7eb;
  color: #2a241d;
}
.crit input:focus {
  outline: none;
  border-color: #127ee8;
  background: #fff;
}

.homes-view-tabs {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f0e8d8;
}
.homes-view-tabs .seg-btn {
  background: #f2ecde;
}
.homes-view-tabs .seg-btn.active {
  background: #2a241d;
  color: #fbf7eb;
}

.homes-meta {
  font-size: 13px;
  color: #7a7164;
  padding: 8px 4px;
  margin-bottom: 12px;
}
.homes-error {
  background: #ffe8e8;
  color: #8b2e2e;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}
.homes-empty {
  padding: 60px 20px;
  text-align: center;
  color: #9e9483;
  font-size: 15px;
  font-style: italic;
}

.homes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.listing-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  border-left: 4px solid #c9a441;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.listing-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.listing-card.rental { border-left-color: #127ee8; }
.listing-card.sale { border-left-color: #c9a441; }
.listing-card.hidden { opacity: 0.55; }

.lc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.lc-mode {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: #f2ecde;
  color: #4a4238;
  padding: 2px 8px;
  border-radius: 4px;
}
.listing-card.rental .lc-mode {
  background: #dbeafe;
  color: #1e3a8a;
}
.lc-price {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 500;
  color: #2a241d;
}
.lc-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.lc-fav, .lc-hide {
  background: transparent;
  border: 1px solid #e0d9cb;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  color: #7a7164;
  font-family: inherit;
  transition: all 120ms ease;
}
.lc-fav:hover { color: #e53935; border-color: #e53935; }
.lc-fav.active { background: #ffe8e8; color: #e53935; border-color: #e53935; }
.lc-hide:hover { color: #8b2e2e; border-color: #8b2e2e; }
.lc-hide.active { background: #f2ecde; color: #4a4238; }

.lc-address {
  font-size: 14px;
  font-weight: 500;
  color: #2a241d;
  margin-bottom: 6px;
  line-height: 1.35;
}
.lc-specs {
  font-size: 13px;
  color: #4a4238;
  margin-bottom: 4px;
}
.lc-dom {
  font-size: 12px;
  color: #9e9483;
  margin-bottom: 4px;
}
.lc-agent {
  font-size: 12px;
  color: #7a7164;
  font-style: italic;
  margin-bottom: 4px;
}
.lc-links {
  margin-top: 8px;
  font-size: 12px;
}
.lc-links a {
  color: #127ee8;
  text-decoration: none;
}
.lc-links a:hover { text-decoration: underline; }

/* Neighborhood map popup header with info button */
.popup-header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.popup-info {
  background: transparent;
  border: 1px solid #d9d2c6;
  color: #7a7164;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  font-family: inherit;
  flex-shrink: 0;
}
.popup-info:hover {
  background: #e8f0f9;
  color: #127ee8;
  border-color: #127ee8;
}

/* House markers for favorited listings */
.house-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23127ee8'><path d='M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z'/></svg>") no-repeat center;
  background-size: 18px 18px;
  border: 2.5px solid #127ee8;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.house-marker:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 50;
}
.house-marker.rental {
  border-color: #0e7a4a;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230e7a4a'><path d='M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z'/></svg>");
}
.house-marker.sale {
  border-color: #c9a441;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23c9a441'><path d='M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z'/></svg>");
}

/* Homes grouped-by-neighborhood layout */
.homes-groups {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.homes-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.homes-group-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 4px 8px;
  border-bottom: 2px solid #e8e1d3;
}
.homes-group-header h3 {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 500;
  color: #2a241d;
  margin: 0;
}
.homes-group-count {
  font-size: 12px;
  color: #7a7164;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Neighborhood checklist filter on Homes tab */
.homes-hood-filter {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #f0e8d8;
}
.homes-hood-filter.empty {
  color: #9e9483;
  font-size: 13px;
  font-style: italic;
  text-align: center;
  padding: 12px;
}
.hhf-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.hhf-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #7a7164;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.hhf-bulk {
  display: flex;
  gap: 12px;
}
.hhf-link {
  background: none;
  border: none;
  color: #127ee8;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  font-family: inherit;
  text-decoration: underline;
}
.hhf-link:hover { color: #0e6bc8; }
.hhf-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.hhf-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f2ecde;
  padding: 5px 10px 5px 8px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 12px;
  color: #7a7164;
  transition: all 120ms ease;
  user-select: none;
}
.hhf-item:hover { background: #e8ddc0; }
.hhf-item.checked {
  background: #e8f0f9;
  color: #0e6bc8;
}
.hhf-item input {
  cursor: pointer;
  accent-color: #127ee8;
  margin: 0;
}

/* Checkbox-style criterion (yard/garden filter) */
.crit.crit-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: #f2ecde;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  align-self: flex-end;
  height: 38px;
}
.crit.crit-check:hover { background: #e8ddc0; }
.crit.crit-check input {
  margin: 0;
  cursor: pointer;
  accent-color: #127ee8;
  width: 16px;
  height: 16px;
}
.crit.crit-check span {
  font-size: 13px;
  color: #2a241d;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
