/* Dream House — Philipp's design system, liquid-glass edition.
   Warm near-black + gold. Instrument Serif / DM Sans / JetBrains Mono.
   Phone first (375 px, no horizontal scroll), desktop ≥ 900 px.

   Principle: the photos and the numbers are the content; the chrome is glass that
   floats above them. Blur is spent only on the things that actually float (header,
   tab bar, sheet, chips over photos, toasts) — cards stay cheap. */

:root {
  --bg: #f5f2ec;
  --bg-2: #ece6da;
  --surface: #ffffff;
  --surface-card: rgba(255, 255, 255, 0.72);
  --surface-inset: rgba(26, 23, 19, 0.04);
  --ink: #1a1713;
  --muted: #6f6759;
  --line: rgba(26, 23, 19, 0.1);
  --line-strong: rgba(26, 23, 19, 0.18);
  --gold: #b8892b;
  --gold-2: #d9ac47;
  --gold-soft: rgba(184, 137, 43, 0.14);
  --gold-glow: rgba(217, 172, 71, 0.38);
  --on-gold: #1a1713;
  --ok: #3b7d4f;
  --warn: #b5541d;
  --danger: #a13a2f;

  --aurora-1: rgba(217, 172, 71, 0.26);
  --aurora-2: rgba(255, 255, 255, 0.9);
  --aurora-3: rgba(184, 137, 43, 0.14);

  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-line: rgba(26, 23, 19, 0.08);
  --glass-shadow: 0 1px 2px rgba(26, 23, 19, 0.05), 0 14px 36px -14px rgba(26, 23, 19, 0.28);
  --card-shadow: 0 1px 2px rgba(26, 23, 19, 0.04), 0 10px 28px -16px rgba(26, 23, 19, 0.22);
  --card-shadow-hover: 0 2px 4px rgba(26, 23, 19, 0.05), 0 22px 44px -18px rgba(26, 23, 19, 0.32);
  --seg-thumb: #ffffff;
  --seg-thumb-shadow: 0 1px 2px rgba(26, 23, 19, 0.1), 0 3px 10px -4px rgba(26, 23, 19, 0.28);
  --blur: 22px;
  --sat: 170%;

  --radius-xl: 28px;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --tap: 44px;

  --display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --nav-top-h: 54px;
  --rail-w: 60px;
  --map-h: calc(100dvh - var(--nav-top-h));
  --tabbar-h: 64px;
  --tabbar-inset: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #121010;
    --bg-2: #1a1613;
    --surface: #1f1b18;
    --surface-card: rgba(44, 39, 35, 0.62);
    --surface-inset: rgba(255, 255, 255, 0.05);
    --ink: #f3eee4;
    --muted: #a59c8d;
    --line: rgba(243, 238, 228, 0.1);
    --line-strong: rgba(243, 238, 228, 0.18);
    --gold: #d4a848;
    --gold-2: #ecc56c;
    --gold-soft: rgba(212, 168, 72, 0.16);
    --gold-glow: rgba(212, 168, 72, 0.32);
    --aurora-1: rgba(212, 168, 72, 0.14);
    --aurora-2: rgba(140, 104, 48, 0.12);
    --aurora-3: rgba(212, 168, 72, 0.07);
    --glass: rgba(38, 33, 29, 0.55);
    --glass-strong: rgba(38, 33, 29, 0.8);
    --glass-edge: rgba(255, 255, 255, 0.12);
    --glass-line: rgba(255, 255, 255, 0.09);
    --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 18px 44px -16px rgba(0, 0, 0, 0.7);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 30px -16px rgba(0, 0, 0, 0.6);
    --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -18px rgba(0, 0, 0, 0.75);
    --seg-thumb: rgba(255, 255, 255, 0.13);
    --seg-thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #121010;
  --bg-2: #1a1613;
  --surface: #1f1b18;
  --surface-card: rgba(44, 39, 35, 0.62);
  --surface-inset: rgba(255, 255, 255, 0.05);
  --ink: #f3eee4;
  --muted: #a59c8d;
  --line: rgba(243, 238, 228, 0.1);
  --line-strong: rgba(243, 238, 228, 0.18);
  --gold: #d4a848;
  --gold-2: #ecc56c;
  --gold-soft: rgba(212, 168, 72, 0.16);
  --gold-glow: rgba(212, 168, 72, 0.32);
  --aurora-1: rgba(212, 168, 72, 0.14);
  --aurora-2: rgba(140, 104, 48, 0.12);
  --aurora-3: rgba(212, 168, 72, 0.07);
  --glass: rgba(38, 33, 29, 0.55);
  --glass-strong: rgba(38, 33, 29, 0.8);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --glass-line: rgba(255, 255, 255, 0.09);
  --glass-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 18px 44px -16px rgba(0, 0, 0, 0.7);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 12px 30px -16px rgba(0, 0, 0, 0.6);
  --card-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.3), 0 24px 48px -18px rgba(0, 0, 0, 0.75);
  --seg-thumb: rgba(255, 255, 255, 0.13);
  --seg-thumb-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 2px 8px -2px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* Browsers without backdrop-filter get an opaque-enough pane instead of see-through mush. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root, :root[data-theme='dark'], :root:not([data-theme='light']) {
    --glass: var(--glass-strong);
    --surface-card: var(--surface);
  }
}

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

html, body { max-width: 100%; overflow-x: hidden; }
/* `clip` on body, not `hidden`: `hidden` made body a scroll container that never scrolls,
   so a `position: sticky` inside it (Market's region tabs) stuck to that instead of the
   page. html keeps `hidden`, which the viewport takes. */
body { overflow-x: clip; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* The light the glass refracts: a fixed, soft aurora behind everything. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70% 55% at 6% 0%, var(--aurora-1) 0%, transparent 62%),
    radial-gradient(55% 45% at 100% 18%, var(--aurora-2) 0%, transparent 62%),
    radial-gradient(50% 45% at 55% 105%, var(--aurora-3) 0%, transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body.has-sheet { overflow: hidden; }

h1, h2, h3 { font-family: var(--display); font-weight: 400; letter-spacing: 0.005em; margin: 0; }
h1 { font-size: 30px; line-height: 34px; }
h2 { font-size: 22px; line-height: 28px; }
h3 { font-size: 18px; line-height: 24px; }
p { margin: 0 0 10px; }
a { color: inherit; }
small, .small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 14px; font-feature-settings: 'tnum' 1; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 8px;
}

/* --- glass: the one recipe every floating surface shares ------------------- */

.tabbar,
.sheet,
.toast,
.nav-stats,
.user-btn,
.card-badges .pill,
.card-ring,
.card-pin,
.card-step-face,
.gallery-count,
.gallery-nav,
.map-legend-control,
.leaflet-bar,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}

/* --- nav, phone shape: stats + tools in a slim row at the top of the page, tabs
       in the floating capsule at the bottom. The rail shape lives in the desktop block. */

.sidebar { display: contents; }
.sidebar::before { content: none; }

/* The mark: a gold tile with a joglo roof and a sun. Top-left on a phone, top of the rail on desktop. */
.logo {
  position: absolute;
  top: 10px;
  left: 14px;
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  filter: drop-shadow(0 6px 10px var(--gold-glow));
  transition: transform 0.2s var(--ease);
}
.logo svg { display: block; }
.logo:active { transform: scale(0.94); }

.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: var(--nav-top-h);
  padding: 10px 14px 0 64px;
}

.nav-stats {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  box-shadow: inset 0 1px 0 var(--glass-edge);
}
.nav-stats:empty { display: none; }
.stat { display: inline-flex; align-items: baseline; gap: 4px; }
.stat b { color: var(--gold); font-weight: 600; font-family: var(--mono); font-size: 13px; }

.nav-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.icon-btn {
  min-width: var(--tap);
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { background: var(--gold-soft); }
.icon-btn:active { transform: scale(0.92); }

.user-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge);
  transition: transform 0.2s var(--ease);
}
.user-btn:active { transform: scale(0.92); }

/* The account popover (SPEC §17): name + group, People (owners only), Sign out. Anchored
   like the sort menu (.menu, home.js) but off the user button instead of the sort button. */
.account-wrap { position: relative; }
.account-menu-head { padding: 8px 12px 6px; display: flex; flex-direction: column; gap: 2px; }
.account-menu-head strong { font-family: var(--display); font-size: 16px; color: var(--ink); }
.account-menu-sep { height: 1px; margin: 2px 6px 4px; background: var(--glass-line); }

/* --- tab bar: a floating glass capsule ----------------------------------- */

.tabbar {
  position: fixed;
  left: var(--tabbar-inset);
  right: var(--tabbar-inset);
  bottom: calc(var(--tabbar-inset) + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: grid;
  /* Solo hides Shared, a member hides Agent (SPEC §17) — auto columns so 4, 5 or 6 visible
     tabs still fill the capsule evenly instead of a fixed 6-track grid leaving a gap. */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  height: var(--tabbar-h);
  padding: 6px;
  border-radius: 999px;
}

.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--muted);
  border-radius: 999px;
  transition: color 0.2s var(--ease);
}
/* .tab's own `display` beats the UA rule for [hidden] (same fix as .sheet/.backdrop below)
   — say it explicitly, or a solo/member's hidden tab still reserves its grid track. */
.tab[hidden] { display: none; }
.tab::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-soft), transparent 130%);
  box-shadow: inset 0 1px 0 var(--glass-edge), inset 0 0 0 1px var(--glass-line);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.25s var(--ease), transform 0.3s var(--ease);
}
.tab > * { position: relative; }
.tab .icon { transition: transform 0.3s var(--ease); }
.tab[aria-current='page'] { color: var(--gold); }
.tab[aria-current='page']::before { opacity: 1; transform: none; }
.tab[aria-current='page'] .icon { transform: translateY(-1px); }
.tab:active .icon { transform: scale(0.9); }
/* An owner has seven tabs: ~49 px each on a 360 px phone — the label has to give a little. */
@media (max-width: 400px) {
  .tab { font-size: 9.5px; letter-spacing: 0; gap: 2px; }
}

main.view {
  padding: 14px 14px calc(var(--tabbar-h) + var(--tabbar-inset) * 2 + 24px);
  max-width: 1200px;
  margin: 0 auto;
}

/* --- buttons, fields ------------------------------------------------------ */

.btn {
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  transition: transform 0.18s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.btn:hover { border-color: var(--gold); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: transparent;
  color: var(--on-gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 22px -10px var(--gold-glow);
}
.btn-primary:hover { border-color: transparent; filter: brightness(1.04); }
.btn-ghost { background: none; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--gold-soft); border-color: transparent; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13px; }

input[type='text'], input[type='email'], input[type='password'], input[type='number'],
input[type='date'], input[type='search'], select, textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 9px 14px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  box-shadow: inset 0 1px 0 var(--glass-edge);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  outline: none;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 0 0 4px var(--gold-soft);
}

.field { display: block; margin-bottom: 12px; }
.field > .label, .filter-group > .label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

/* Segmented control: a glass track with a raised thumb. */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-inset);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}
.seg button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.seg button[aria-pressed='true'] { background: var(--seg-thumb); color: var(--ink); box-shadow: var(--seg-thumb-shadow); }
/* Inside the filter panel a segment never wraps: equal columns, one row. */
.filter-group .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
.filter-group .seg button { padding: 0 4px; font-size: 12px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-inset);
}
button.chip {
  min-height: 36px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 0 14px;
  background: var(--surface-card);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.18s var(--ease);
}
button.chip:active { transform: scale(0.96); }
button.chip[aria-pressed='true'] { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-size: 14px;
  cursor: pointer;
}
.check input { width: 18px; height: 18px; accent-color: var(--gold); flex: none; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}
.pill-shortlist, .pill-offer { border-color: var(--ok); color: var(--ok); }
.pill-contacted, .pill-viewing_booked, .pill-viewed { border-color: var(--gold); color: var(--gold); }
.pill-rejected { border-color: var(--danger); color: var(--danger); }
.pill-gone { border-color: var(--line-strong); color: var(--muted); text-decoration: line-through; }
.pill-flagged { border-color: transparent; background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--on-gold); }
.pill-flag { border-color: var(--danger); color: var(--danger); }

.ring { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ring-value { position: absolute; font-family: var(--mono); font-size: 12px; }

/* --- cards ---------------------------------------------------------------- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 2px 10px;
}

.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 264px;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  margin: 0 -14px;
  padding-left: 14px;
  padding-right: 14px;
  scrollbar-width: thin;
}
.strip > * { scroll-snap-align: start; }

.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }

.card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--surface-card);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}
@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow-hover); border-color: var(--line-strong); }
  .card:hover .card-media img { transform: scale(1.03); }
}
/* An arrow tap is not a press on the card: it keeps still. */
.card:active:not(:has(.card-step:active)) { transform: scale(0.99); }

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(160deg, var(--gold-soft), var(--surface-inset));
  overflow: hidden;
  margin: 6px 6px 0;
  border-radius: calc(var(--radius) - 6px);
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s var(--ease); }
.card-media .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-family: var(--display);
  font-size: 16px;
  font-style: italic;
}
.card-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.card-badges .pill { border-radius: 999px; box-shadow: inset 0 1px 0 var(--glass-edge); }
.card-badges .pill-flagged { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.card-ring { position: absolute; right: 8px; bottom: 8px; display: flex; line-height: 0; border-radius: 999px; padding: 3px; }

.card-body { padding: 12px 14px 14px; display: grid; gap: 6px; min-width: 0; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-price { font-family: var(--mono); font-size: 14px; font-weight: 500; }
.card-title {
  font-family: var(--display);
  font-size: 19px;
  line-height: 23px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 13px; color: var(--muted); align-items: center; }
.card-meta .mono { font-size: 13px; }
.card-reason { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-link { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; color: var(--muted); }
.pin-link:hover { color: var(--gold); }

.empty { color: var(--muted); padding: 18px 2px; font-size: 14px; }
.loading { color: var(--muted); padding: 18px 2px; font-size: 14px; }

/* --- home toolbar / filters ---------------------------------------------- */

.home-layout { display: block; }
.rail { display: none; }

/* One row on desktop: Filters · sort · Work through · count. On a phone the Work-through
   chips wrap onto a second row and the bar scrolls with the page instead of sticking. */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 0 10px;
  margin: -4px 0 0;
}
.toolbar .flow-strip { flex: 1 1 auto; min-width: 0; margin: 0; }
.toolbar-count { white-space: nowrap; }
.sort-wrap { position: relative; margin-left: auto; }
.sort-btn { gap: 6px; padding: 0 10px 0 12px; }
.sort-btn .icon:last-child { width: 16px; height: 16px; color: var(--muted); transition: transform 0.2s var(--ease); }
.sort-btn[aria-expanded='true'] .icon:last-child { transform: rotate(180deg); }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 220px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--surface-card);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow-hover);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
}
.menu[hidden] { display: none; }
.menu button {
  min-height: var(--tap);
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: var(--gold-soft); }
.menu button[aria-checked='true'] { color: var(--gold); font-weight: 500; }
.load-more { display: flex; justify-content: center; padding: 18px 0 6px; }
.load-more .btn { min-width: 180px; }
.toolbar .seg { flex: 1; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; background: var(--glass); -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat)); backdrop-filter: blur(var(--blur)) saturate(var(--sat)); box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow); }
.toolbar .seg::-webkit-scrollbar { display: none; }
.toolbar .seg button { white-space: nowrap; }
/* Home's New segment: bold always, the gold gradient when it is the chosen one. */
#my-call button[value='none'] { font-weight: 600; }
#my-call button[value='none'][aria-pressed='true'] { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--on-gold); }
.filter-count[hidden] { display: none; }
.filter-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--on-gold);
  font-size: 11px;
  font-family: var(--mono);
}

/* No dividers between groups; the label rhythm alone separates them. */
.filters { display: grid; gap: 4px; }
.filter-group { padding-top: 6px; }
.filter-group:first-child { padding-top: 0; }
.filter-group .group-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 8px 0 4px; }
.filter-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }

/* Area: a collapsible group, each coast with All / Clear. */
.filter-area > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.filter-area > summary::-webkit-details-marker { display: none; }
.filter-area > summary .label { margin: 0; }
.summary-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--gold); }
.summary-hint .icon { color: var(--muted); transition: transform 0.25s var(--ease); }
.filter-area[open] > summary .summary-hint .icon { transform: rotate(180deg); }
/* A region inside the Area drawer: same header as a group, but it folds away. */
.filter-region { border-top: 1px solid var(--line); }
.filter-region:first-of-type { border-top: 0; }
.filter-region > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.filter-region > summary::-webkit-details-marker { display: none; }
.filter-region > summary .group-label { margin: 0; }
.filter-region > summary .icon { color: var(--muted); transition: transform 0.25s var(--ease); }
.filter-region[open] > summary .icon { transform: rotate(180deg); }
.filter-region .group-actions { align-items: center; }
.region-count {
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--bg);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.filter-region > .filter-cols { padding-bottom: 8px; }

.group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 0; }
.group-head .group-label { margin: 0; }
.group-actions { display: inline-flex; gap: 2px; }
.link-btn {
  min-height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--gold);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.link-btn:hover { background: var(--gold-soft); }

/* Sliders: quiet track, gold fill for the chosen span, round white thumbs. The fill
   positions (--lo / --hi / --val) are written by home.js on every input. */
/* Price distribution above the slider: one bar per bucket, gold between the thumbs. The
   bars end on the track, and the side margins line them up with the thumbs' travel. */
.range-hist { display: flex; align-items: flex-end; gap: 2px; height: 44px; margin: 8px 11px -18px; position: relative; }
.range-hist:empty { display: none; }
.range-hist span {
  flex: 1 1 0;
  min-width: 0;
  height: max(3px, var(--h, 0%));
  border-radius: 3px 3px 0 0;
  background: var(--line-strong);
  opacity: 0.6;
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}
.range-hist span.is-in { background: linear-gradient(180deg, var(--gold-2), var(--gold)); opacity: 1; }

.range-dual { position: relative; height: 40px; margin-top: 2px; --lo: 0%; --hi: 100%; }
.range-dual::before, .range-dual::after {
  content: '';
  position: absolute;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 999px;
  pointer-events: none;
}
.range-dual::before { left: 0; right: 0; background: var(--line-strong); }
.range-dual::after { left: var(--lo); right: calc(100% - var(--hi)); background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.range-dual input[type='range'] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 40px;
  min-height: 0;
  margin: 0;
  background: none;
  pointer-events: none;
  z-index: 1;
}
.range-dual input[type='range']::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.range-dual input[type='range']::-moz-range-track { height: 4px; background: transparent; }
.range-dual input[type='range']::-webkit-slider-thumb { pointer-events: auto; }
.range-dual input[type='range']::-moz-range-thumb { pointer-events: auto; }

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 40px;
  margin: 0;
  background: none;
  --val: 100%;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold) 0, var(--gold-2) var(--val), var(--line-strong) var(--val));
}
input[type='range']::-moz-range-track { height: 4px; border-radius: 999px; background: var(--line-strong); }
input[type='range']::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--gold); }
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: inset 0 0 0 2px var(--gold), 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 8px -2px rgba(0, 0, 0, 0.3);
  cursor: grab;
  transition: transform 0.15s var(--ease);
}
input[type='range']::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: inset 0 0 0 2px var(--gold), 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 8px -2px rgba(0, 0, 0, 0.3);
  cursor: grab;
}
input[type='range']:active::-webkit-slider-thumb { transform: scale(1.12); cursor: grabbing; }
input[type='range']:focus-visible { outline: none; }
input[type='range']:focus-visible::-webkit-slider-thumb { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 4px var(--gold-soft); }
.range-readout { font-family: var(--mono); font-size: 14px; display: flex; justify-content: flex-end; }
/* A range group puts its label and readout on one line; the slider spans below. */
.filter-group:has(> .range-readout) { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: baseline; }
.filter-group:has(> .range-readout) > .label { margin-bottom: 2px; }
.filter-group:has(> .range-readout) > :not(.label):not(.range-readout) { grid-column: 1 / -1; }

/* --- sheet, backdrop, toasts --------------------------------------------- */

/* a class with `display` beats the UA rule for [hidden] — say it explicitly */
.sheet[hidden], .backdrop[hidden] { display: none !important; }

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 8, 0.3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 50;
  animation: fade-in 0.25s var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  border-bottom: 0;
  animation: sheet-in 0.32s var(--ease);
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet::before {
  /* grabber */
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 18px 10px 8px 20px;
}
.sheet-title { font-size: 22px; }
.sheet-body { padding: 8px 20px calc(20px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; }

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--tabbar-inset) + 14px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  justify-items: center;
}
.toast {
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  animation: toast-in 0.35s var(--ease);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
@keyframes toast-in { from { transform: translateY(12px) scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.toast-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.toast-out { opacity: 0; transform: translateY(6px); }

/* --- detail --------------------------------------------------------------- */

.detail-page { display: block; }
.detail-back { margin-bottom: 10px; padding-left: 8px; }

.detail-head { display: grid; gap: 10px; margin: 18px 2px 0; }
.detail-title { font-size: 27px; line-height: 32px; }
.detail-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.detail-price { font-family: var(--mono); font-size: 16px; font-weight: 500; }

/* First scan: photos, read, tap a status. Scrolls sideways on a phone, never wraps. */
.status-row {
  display: flex;
  gap: 6px;
  margin: 14px -14px 0;
  padding: 2px 14px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.status-row::-webkit-scrollbar { display: none; }
.status-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.18s var(--ease);
}
.status-btn:hover { border-color: var(--gold); color: var(--ink); }
.status-btn:active { transform: scale(0.96); }
.status-btn[aria-pressed='true'] {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: transparent;
  color: var(--on-gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 18px -8px var(--gold-glow);
}
.status-row-end { display: inline-flex; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.status-stage {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
}
.status-stage-shortlist { color: var(--on-gold); border: 1px solid transparent; background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 8px 18px -8px var(--gold-glow); }
.status-stage .who-set { width: 20px; height: 20px; font-size: 11px; margin-left: 7px; background: rgba(0, 0, 0, 0.14); border: 0; color: inherit; }
.status-btn-gone[aria-pressed='true'] { background: var(--muted); border-color: transparent; color: var(--bg); box-shadow: none; }
.status-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--glass-line)); }
.status-btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.status-btn-danger[aria-pressed='true'] { background: var(--danger); border-color: transparent; color: #fff; box-shadow: none; }

/* Detail tabs: a scrolling glass segmented control. */
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  margin: 14px 0 14px;
  padding: 3px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-inset);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  flex: 1 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tab-btn[aria-selected='true'] { color: var(--ink); background: var(--seg-thumb); box-shadow: var(--seg-thumb-shadow); }

.login-identities { border: 0; padding: 0; min-width: 0; }
.login-identity-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.login-identity-options label {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer;
}
.login-identity-options label:has(input:checked) { background: var(--seg-thumb); }
.login-identity-options input { accent-color: var(--gold); }

.panel { display: grid; gap: 14px; }
.block {
  background: var(--surface-card);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
}
.block > h3 { margin-bottom: 10px; }

/* Hero gallery: a rounded photo card, edge to edge on a phone. */
.gallery-wrap { position: relative; margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: linear-gradient(160deg, var(--gold-soft), var(--surface-inset));
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 62vh;
  object-fit: cover;
  display: block;
  scroll-snap-align: center;
  background: var(--gold-soft);
}
.gallery-empty {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  max-height: 46vh;
  background: linear-gradient(160deg, var(--gold-soft), var(--surface-inset));
  color: var(--muted);
  font-family: var(--display);
  font-style: italic;
  font-size: 17px;
}
.gallery-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}
.gallery-nav {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: var(--tap);
  height: var(--tap);
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.gallery-nav:hover { background: var(--glass-strong); }
.gallery-nav:active { transform: translateY(-50%) scale(0.92); }
.gallery-prev { left: 12px; }
.gallery-next { right: 12px; }

.mini-map {
  position: relative;
  height: 220px;
  margin-bottom: 10px;
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--gold-soft);
}
.mini-map iframe, .mini-map .leaflet-container { width: 100%; height: 100%; border: 0; display: block; }
.mini-map-note { margin: -4px 0 10px; }

.description { font-size: 15px; }
.description p { margin: 0 0 10px; }
.description p:last-child, .description ul:last-child { margin-bottom: 0; }
.description strong { color: var(--ink); font-weight: 500; }
.desc-list { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }

.kv { display: grid; grid-template-columns: minmax(96px, 40%) 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv dd.mono { font-size: 13px; }

.links { display: grid; gap: 6px; }
.links a { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; font-size: 14px; overflow-wrap: anywhere; }

.scale-row { display: grid; gap: 4px; margin-bottom: 12px; }
.scale-row .label { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.scale { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-inset); border: 1px solid var(--glass-line); }
.scale button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.scale button[aria-pressed='true'] { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--on-gold); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4); }

.bars { display: flex; gap: 8px; flex-wrap: wrap; }
.bar { display: grid; gap: 3px; font-size: 11px; color: var(--muted); }
.bar-track { width: 46px; height: 5px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }

.stars { display: inline-flex; gap: 2px; }
/* A member's read-only responsiveness (detail-panels.js) swaps the button for a plain
   span — same face, no tap target, since PATCH /api/contacts/:id is the owners' alone. */
.stars button, .stars span { min-width: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--line-strong); font-size: 18px; line-height: 1; }
.stars button { cursor: pointer; }
.stars button[data-on='1'], .stars span[data-on='1'] { color: var(--gold); }

.pipeline { display: flex; flex-wrap: wrap; gap: 6px; }

.entry { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.entry:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.entry-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }

.photo-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.photo-row img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-xs); }

.template { border-top: 1px solid var(--line); padding: 10px 0; }
.template:first-of-type { border-top: 0; }
.template-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.template-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.template-actions .btn { text-decoration: none; }
.template pre {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: var(--surface-inset);
  border-radius: var(--radius-sm);
  font-family: var(--body);
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.mono, th.mono { font-family: var(--mono); font-size: 13px; }

.weights { display: grid; gap: 10px; }
.weight-row { display: grid; grid-template-columns: 1fr; gap: 2px; }
.weight-row .label { display: flex; justify-content: space-between; font-size: 14px; }

.login-wrap {
  max-width: 380px;
  margin: 10vh auto 0;
  padding: 28px 24px 24px;
  background: var(--surface-card);
  border: 1px solid var(--glass-line);
  border-radius: var(--radius-xl);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.login-wrap h1 { font-size: 36px; line-height: 40px; }
.login-wrap > p { margin: 6px 0 20px; }

/* --- map view: full-bleed under the floating tab bar ---------------------- */

main.view:has(> .map-view) { padding: 0; max-width: none; }
/* Leaflet's panes carry z-index 400+; keep them inside the map so the nav stays on top. */
.map-view, .mini-map { isolation: isolate; }
.leaflet-bar { border-radius: 14px; overflow: hidden; }
.leaflet-bar a { background: transparent; color: var(--ink); border-bottom-color: var(--glass-line); }
.leaflet-bar a:hover { background: var(--gold-soft); }
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); color: var(--ink); }
.leaflet-popup-tip { box-shadow: none; }
.leaflet-container .leaflet-control-attribution { background: var(--glass); color: var(--muted); border-radius: 999px 0 0 0; }
.leaflet-container .leaflet-control-attribution a { color: var(--gold); }
.leaflet-bottom { bottom: calc(var(--tabbar-h) + var(--tabbar-inset) + env(safe-area-inset-bottom, 0px)); }

/* --- desktop -------------------------------------------------------------- */

@media (min-width: 900px) {
  :root { --map-h: 100dvh; }
  /* Content hugs the rail on the left; the top 68 px is a band for the stats chip. */
  main.view { padding: 68px 24px 48px calc(var(--rail-w) + 36px); max-width: calc(1400px + var(--rail-w) + 36px); margin: 0; }
  /* Home starts with the filters rail and the toolbar, not a title: no headroom needed. */
  main.view:has(> .home-layout) { padding-top: 10px; }

  /* nav, rail shape: logo on top, sections centred, tools pinned to the bottom. The glass
     lives on ::before so the rail itself has no filter — a filter would trap the fixed
     stats chip inside it. */
  .sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: var(--rail-w);
    z-index: 40;
    padding: 10px 4px 10px;
  }
  .sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: var(--radius-xl);
    background: var(--glass);
    -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
    backdrop-filter: blur(var(--blur)) saturate(var(--sat));
    border: 1px solid var(--glass-line);
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  }
  .logo { position: static; order: 0; flex: none; }
  .nav-top { display: contents; }
  .nav-stats {
    position: fixed;
    top: 18px;
    right: 24px;
    z-index: 30;
    padding: 8px 14px;
    gap: 12px;
  }
  .count-wide { display: inline-flex; }
  .tabbar {
    order: 1;
    position: static;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 4px;
    height: auto;
    margin: auto 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }
  .tab { min-height: 56px; padding: 0 2px; font-size: 10px; letter-spacing: 0; }
  .nav-tools { order: 2; flex-direction: column; align-items: center; gap: 8px; margin: 0; }
  /* The rail is only var(--rail-w) wide — the popover's default right:0 would run mostly
     off the left edge of the viewport. Flip it: open upward (the button sits near the
     rail's bottom) and rightward, into the page instead of off it. */
  .account-menu { top: auto; bottom: calc(100% + 6px); left: 0; right: auto; }
  .toolbar .seg { flex: 0 1 auto; }
  /* Scrolls with the page. It was `sticky` from 2026-09-19, but body's old
     `overflow-x: hidden` kept it from ever sticking; its chips have no glass to float on. */
  .toolbar { position: relative; z-index: 20; flex-wrap: nowrap; }
  .toolbar .flow-strip { flex: 0 1 auto; margin-left: 6px; }

  .toasts { bottom: 28px; }
  .home-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; align-items: start; }
  /* The rail scrolls with the page — no inner scrollbar, every filter always reachable. */
  .rail {
    display: block;
    padding: 18px;
    background: var(--surface-card);
    border: 1px solid var(--glass-line);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  }
  .rail-title { margin-bottom: 12px; }
  .toolbar { padding-top: 18px; margin-top: -18px; padding-bottom: 18px; }
  .filters-toggle { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
  /* Desktop cards read ~20% larger inside the same column count: taller photo, type
     and spacing ×1.2. The phone keeps the compact card (thumb reach, one column). */
  .card-media { aspect-ratio: 10 / 9; margin: 7px 7px 0; }
  .card-media .placeholder { font-size: 19px; }
  .card-badges { top: 10px; left: 10px; gap: 7px; }
  .card-badges .pill { padding: 4px 12px; font-size: 14px; }
  .card-ring { right: 10px; bottom: 10px; }
  .card-ring svg { width: 48px; height: 48px; }
  .card-body { padding: 14px 17px 17px; gap: 7px; }
  .card-price { font-size: 17px; }
  .card-title { font-size: 23px; line-height: 28px; }
  .card-meta, .card-meta .mono, .card-reason { font-size: 16px; }
  .card-meta { gap: 7px 12px; }
  .detail-page { max-width: 880px; margin: 0 auto; }
  .detail-title { font-size: 32px; line-height: 36px; }
  .gallery img { aspect-ratio: 16 / 9; }
  .gallery-nav { display: flex; }
  .mini-map { height: 280px; }
  .status-row { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; overflow-x: visible; flex-wrap: nowrap; }
  .tabs { width: max-content; max-width: 100%; }
  .filter-cols { grid-template-columns: 1fr 1fr; }
  .scale { max-width: 340px; }
  .leaflet-bottom { bottom: 0; }
  main.view:has(> .map-view) { padding: 0 0 0 calc(var(--rail-w) + 24px); max-width: none; }
  .leaflet-left { left: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* card hit area + pin (a pin link cannot nest inside the card's own link) */
.card-hit { display: block; color: inherit; text-decoration: none; }
.card-pin {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  border-radius: 999px;
  color: var(--ink);
}

/* photo arrows (siblings of the card link for the same reason as the pin): a strip laid
   exactly over .card-media — same inset, same aspect — that lets every tap through to
   the link except the two buttons'. 44 px to tap, a 36 px glass face like the pin. */
.card-steps {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  aspect-ratio: 4 / 3;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  pointer-events: none;
}
.card-step {
  pointer-events: auto;
  width: var(--tap);
  height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.card-step-face {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.card-step-face .icon { width: 18px; height: 18px; }
.card-step:hover .card-step-face { background: var(--glass-strong); }
.card-step:active .card-step-face { transform: scale(0.92); }
.card-step:focus-visible { outline: none; }
.card-step:focus-visible .card-step-face { outline: 2px solid var(--gold); outline-offset: 2px; }
/* With a mouse the arrows wait for the pointer (or keyboard focus); a phone always shows them. */
@media (hover: hover) {
  .card-steps { opacity: 0; transition: opacity 0.2s var(--ease); }
  .card:hover .card-steps,
  .card:focus-within .card-steps { opacity: 1; }
}
@media (min-width: 900px) {
  .card-steps { top: 7px; left: 7px; right: 7px; aspect-ratio: 10 / 9; }
}

/* the stats chip loses its least important third on narrow phones */
@media (max-width: 480px) {
  .count-wide { display: none; }
}

/* --- Agent page: intake sources -------------------------------------------- */

.source-group + .source-group { margin-top: 14px; }

.source-group-head {
  font-family: var(--body);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}

.source-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}
.source-group-head + .source-row { border-top: 0; }

.source-main { flex: 1; min-width: 0; }

.source-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.source-head a, .source-head span:not(.pill) { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; }
.source-head a { text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.source-head a:hover { border-bottom-color: var(--gold); }

.source-stats { margin: 4px 0 0; font-size: 12px; }

.source-note, .source-note-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  text-align: left;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-height: var(--tap);
  cursor: text;
  box-shadow: none;
}
.source-note:hover { border-color: var(--line); }
.source-note.is-empty { font-style: italic; opacity: 0.75; }
.source-note-input { background: var(--surface-card); border-color: var(--gold); color: var(--ink); cursor: text; }

.source-add-url { margin-top: 6px; }

/* a real checkbox, visually an iOS switch — the input itself stays the 44 px hit area */
.switch { position: relative; flex: 0 0 auto; width: 56px; height: var(--tap); }
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch-track {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 52px;
  height: 31px;
  border-radius: 999px;
  background: var(--line-strong);
  border: 1px solid transparent;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: background 0.25s var(--ease), box-shadow 0.25s var(--ease);
  pointer-events: none;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 3px 8px -2px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s var(--ease);
}
.switch input:checked + .switch-track { background: linear-gradient(180deg, var(--gold-2), var(--gold)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(21px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 4px var(--gold-soft); }
.switch input[disabled] + .switch-track { opacity: 0.5; }

.source-add { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.source-add > summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--gold);
}
.source-add > form { padding-top: 6px; }

.inbox-row { display: flex; gap: 8px; }
.inbox-row input { flex: 1; min-width: 0; }

/* --- duplicate checker ----------------------------------------------------- */
/* Detail page: one candidate per row. Agent page: a pair, both sides, one choice. */

.dup, .dup-side {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.dup { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.dup:first-child { border-top: none; padding-top: 0; margin-top: 0; }

.dup-thumb {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--gold-soft);
  border: 1px solid var(--glass-line);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--muted);
  text-align: center;
}
.dup-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dup-main { flex: 1; min-width: 0; }
.dup-main > p { margin: 2px 0 4px; }
.dup-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dup-head a { color: var(--ink); text-decoration: none; font-weight: 500; }
.dup-head a:hover { color: var(--gold); }

.dup-score { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.dup-bar {
  flex: 1;
  min-width: 60px;
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
  overflow: hidden;
}
.dup-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 999px; }

.dup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dup-actions .btn { min-height: var(--tap); }
.btn-confirm { border-color: var(--danger); color: var(--danger); font-weight: 500; }

.dup-pair { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.dup-pair:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.dup-pair > p { margin: 6px 0 0; }
.dup-sides { display: grid; gap: 10px; margin-top: 6px; }
.dup-side { padding: 10px; border: 1px solid var(--glass-line); border-radius: var(--radius-sm); background: var(--surface-inset); }

@media (min-width: 640px) {
  .dup-sides { grid-template-columns: 1fr 1fr; }
}

/* --- age-of-post / removed-listing filters (villa-age-removed-filters) --- */
.seg-tap button { min-height: 40px; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.card-age { font-size: 12px; color: var(--muted); }
.pill-removed { border-color: var(--danger); color: var(--danger); }

/* --- detail prev/next pager (villa-detail-pager) --------------------------- */
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.detail-top .detail-back { margin-bottom: 0; }
.pager { display: flex; align-items: center; gap: 6px; height: var(--tap); flex: none; }
.pager-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--ink);
  cursor: pointer;
  flex: none;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  transition: transform 0.18s var(--ease), border-color 0.2s var(--ease);
}
.pager-btn:hover { border-color: var(--gold); }
.pager-btn:active { transform: scale(0.92); }
.pager-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.pager-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* --- shared search: verdicts ------------------------------------------------ */
/* Two discs (one per person) coloured by their call, "Match" when both said yes, and
   the viewer's own Yes / Maybe / No. On cards this sits under the link, never inside it. */

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px 12px 14px; }
.verdict-pair { display: inline-flex; align-items: center; gap: 4px; }
.who {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 14px;
  line-height: 1;
  color: var(--muted);
  background: var(--surface-inset);
  border: 1.5px solid var(--line-strong);
}
.who-yes { background: var(--ok); border-color: transparent; color: #fff; }
.who-maybe { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; color: var(--on-gold); }
.who-no { background: var(--danger); border-color: transparent; color: #fff; }
.pill-match { background: var(--ok); border-color: transparent; color: #fff; margin-left: 4px; }

/* --- value: price per m² vs the area, yearly saving ----------------------- */
.value-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.value-ppm2 { font-size: 13px; }
.pill-vs-good { border-color: var(--ok); color: var(--ok); }
.pill-vs-steep { border-color: var(--warn); color: var(--warn); }
.pill-vs-par { border-color: var(--line-strong); color: var(--muted); }
.pill-save { background: var(--gold-soft); border-color: transparent; color: var(--ink); }
.card-body .value-row { margin-top: -2px; }
.detail-head .value-row { margin-top: 2px; }

/* --- anchors: your places -------------------------------------------------- */
.card-anchors { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; }
.card-anchors .muted { font-family: var(--body); }
.anchor-km-row[hidden] { display: none; }
.anchor-add { margin-top: 6px; }
.anchor-add > summary {
  list-style: none;
  display: flex;
  align-items: center;
  min-height: 36px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gold);
}
.anchor-add > summary::-webkit-details-marker { display: none; }
.anchor-form { display: grid; gap: 8px; padding-top: 4px; }
.map-anchor span {
  display: block;
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  border-radius: 4px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.map-legend-anchor { transform: rotate(45deg); border-radius: 2px; background: var(--gold); }

.verdict-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-inset);
  border: 1px solid var(--glass-line);
  transition: opacity 0.2s var(--ease);
}
.verdict-seg.is-busy { opacity: 0.5; pointer-events: none; }
.vbtn {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.18s var(--ease);
}
.vbtn:active { transform: scale(0.95); }
.vbtn-yes[aria-pressed='true'] { background: var(--ok); color: #fff; }
.vbtn-maybe[aria-pressed='true'] { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: var(--on-gold); }
.vbtn-no[aria-pressed='true'] { background: var(--danger); color: #fff; }
/* Hover previews the call in its own colour; the pressed one just brightens. Pointer
   devices only, so a tap on a phone never leaves a stuck tint behind. */
@media (hover: hover) {
  .vbtn-yes:not([aria-pressed='true']):hover { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ink); }
  .vbtn-maybe:not([aria-pressed='true']):hover { background: color-mix(in srgb, var(--gold) 24%, transparent); color: var(--ink); }
  .vbtn-no:not([aria-pressed='true']):hover { background: color-mix(in srgb, var(--danger) 22%, transparent); color: var(--ink); }
  .vbtn[aria-pressed='true']:hover { filter: brightness(1.06); }
}
.verdict-seg-compact .vbtn { min-height: 36px; padding: 0 11px; font-size: 12.5px; }

.status-btn .who-set { width: 20px; height: 20px; font-size: 11px; margin-left: 7px; background: rgba(0, 0, 0, 0.14); border: 0; color: inherit; }

/* Detail: the pair and the viewer's call ride on the photo's top right, under the pager. */
.gallery-verdict {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.gallery-verdict .verdict-seg { background: none; border: 0; padding: 0; }
.gallery-verdict .vbtn { color: var(--ink); }
.gallery img { cursor: pointer; }

.shared-intro { margin: -6px 2px 8px; font-size: 14px; max-width: 60ch; }
.shared-hint { margin: -6px 2px 8px; }
.shared-section + .shared-section { margin-top: 12px; }

/* --- flow mode: work through listings stage by stage (villa-flow-mode) ------ */

/* Home launcher: four chips with the size of each queue. */
.flow-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.flow-strip::-webkit-scrollbar { display: none; }
.flow-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  transition: border-color 0.2s var(--ease), transform 0.18s var(--ease), opacity 0.2s var(--ease);
}
.flow-chip b {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--on-gold);
  font-size: 12px;
  font-weight: 500;
}
.flow-chip:hover { border-color: var(--gold); }
.flow-chip:active { transform: scale(0.96); }
.flow-chip[disabled] { opacity: 0.45; cursor: default; }
.flow-chip[disabled] b { background: var(--surface-inset); color: var(--muted); }

/* Detail: the sticky action bar. Sits just above the tab capsule on a phone. */
.detail-page.in-flow { padding-bottom: 92px; }
.flow-bar {
  position: fixed;
  left: var(--tabbar-inset);
  right: var(--tabbar-inset);
  bottom: calc(var(--tabbar-h) + var(--tabbar-inset) * 2 + env(safe-area-inset-bottom, 0px));
  z-index: 39;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 1px solid var(--glass-line);
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.flow-close,
.flow-skip {
  flex: none;
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.18s var(--ease);
}
.flow-close:hover,
.flow-skip:hover { background: var(--gold-soft); color: var(--ink); }
.flow-skip:active { transform: scale(0.92); }
.flow-meta { display: none; flex-direction: column; line-height: 1.15; min-width: 64px; }
.flow-stage { font-family: var(--display); font-size: 17px; color: var(--ink); }
.flow-count { font-size: 12px; color: var(--muted); }
.flow-actions { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.flow-hint { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flow-hint b { color: var(--ink); font-weight: 500; }
.flow-btn {
  flex: 1;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--card-shadow);
  transition: transform 0.18s var(--ease), border-color 0.2s var(--ease), filter 0.2s var(--ease);
}
.flow-btn:hover { border-color: var(--gold); }
.flow-btn:active { transform: scale(0.96); }
.flow-btn-primary {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  border-color: transparent;
  color: var(--on-gold);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 10px 22px -10px var(--gold-glow);
}
.flow-btn-primary:hover { border-color: transparent; filter: brightness(1.04); }
.flow-btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--glass-line)); }
.flow-btn-danger:hover { border-color: var(--danger); }
.flow-btn[aria-pressed='true'] { outline: 2px solid var(--gold); outline-offset: 1px; }
.flow-btn-danger[aria-pressed='true'] { background: var(--danger); border-color: transparent; color: #fff; outline: none; box-shadow: none; }

@media (min-width: 480px) {
  .flow-meta { display: flex; }
}

@media (min-width: 900px) {
  /* Desktop: no capsule underneath, so the bar hugs the bottom edge of the content column. */
  .detail-page.in-flow { padding-bottom: 88px; }
  .flow-bar {
    left: calc(var(--rail-w) + 36px);
    right: auto;
    width: min(760px, calc(100vw - var(--rail-w) - 60px));
    bottom: 16px;
  }
}

/* --- the archive: what left the market (villa-gone-archive) ---------------- */

/* On a card: when it went, how long it lasted, and why. */
.card-removal {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  font-size: 12px;
  color: var(--danger);
}

.gone-page { display: block; }
.gone-intro { margin: -6px 2px 10px; font-size: 14px; max-width: 62ch; }
.gone-hint { margin: 2px 2px 10px; max-width: 62ch; }
/* Two segmented controls do not fit side by side on a phone: each takes its own row,
   and a control still wider than the screen scrolls rather than falling off it. */
.gone-toolbar { flex-wrap: wrap; gap: 8px; }
.gone-toolbar .seg { flex: 1 1 100%; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.gone-toolbar .seg::-webkit-scrollbar { display: none; }
.gone-toolbar .seg button { flex: 1 0 auto; white-space: nowrap; }
@media (min-width: 720px) {
  .gone-toolbar .seg { flex: 0 1 auto; }
}
.gone-summary { margin: 0 2px 8px; font-size: 12.5px; color: var(--muted); }
.gone-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 2px 14px; }
.gone-reasons .chip { gap: 7px; }
.gone-reasons b { color: var(--ink); font-weight: 500; }

/* --- People (SPEC §17): the owners' mini CMS for teams and their members --- */

.people-team { margin-bottom: 14px; }
.people-team-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 10px; margin-bottom: 10px; }
.people-team-rename {
  background: none;
  border: 0;
  padding: 0;
  min-height: var(--tap);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.people-team-rename:hover { color: var(--gold); }
.people-team-head .small { flex: 1 1 auto; }
.people-team-rename-input { max-width: 260px; }
.person-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.person-id { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; min-width: 0; padding-top: 2px; }
.person-name { font-weight: 500; color: var(--ink); }
.person-entry.is-removed .person-id > :not(.pill),
.person-entry.is-removed .person-stats { opacity: 0.55; }
/* The ⋯ button sits flush with the row's top right; its menu drops under it. */
.person-menu-wrap { position: relative; flex: none; margin: -8px -8px 0 0; }
.person-menu-wrap .icon-btn { color: var(--muted); }
.person-menu-wrap .icon-btn[aria-expanded='true'] { background: var(--gold-soft); color: var(--ink); }
.person-menu-wrap .menu { top: calc(100% + 2px); min-width: 200px; }

/* Yes / Maybe / No tallies: a dot in the verdict's colour, the number, the word. */
.person-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 13px; color: var(--muted); }
.person-stat { display: inline-flex; align-items: center; gap: 6px; }
.person-stat::before { content: ''; width: 8px; height: 8px; border-radius: 999px; }
.person-stat b { color: var(--ink); font-weight: 500; }
.person-stat-yes::before { background: var(--ok); }
.person-stat-maybe::before { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.person-stat-no::before { background: var(--danger); }
#new-team-name-field[hidden] { display: none; }

/* --- menus and dialogs shared by People (and any later ⋯ menu) ------------- */
.menu-sep { height: 1px; margin: 4px 8px; background: var(--line); }
.menu button.menu-danger { color: var(--danger); }
.menu button.menu-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn-danger:hover { border-color: transparent; filter: brightness(1.06); }
.dialog-form { display: grid; gap: 12px; }
.dialog-form .field { margin: 0; }
.dialog-form p { margin: 0; }
.dialog-form [hidden] { display: none; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
/* A dialog is the bottom sheet on a phone; from 720 px it is a centred modal. */
@media (min-width: 720px) {
  .sheet.sheet-dialog {
    top: 50%;
    bottom: auto;
    left: 50%;
    right: auto;
    width: min(440px, calc(100vw - 32px));
    transform: translate(-50%, -50%);
    border-radius: var(--radius-xl);
    border-bottom: 1px solid var(--glass-line);
    animation: dialog-in 0.24s var(--ease);
  }
  .sheet.sheet-dialog::before { display: none; }
  .sheet.sheet-dialog .sheet-head { padding-top: 14px; }
}
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}
