/* SPMI public map. Same palette and type as the CRM (css/app.css). Light only, like the CRM. */
:root {
  --bg: #F6F4EE; --card: #FFFFFF; --line: #E3DFD3; --line-strong: #C2BCA8;
  --ink: #1B1C18; --muted: #55544D;
  --green: #1F3D2B; --green-soft: #E6EEE8; --green-ink: #1F5A33;
  --gold: #A9822F; --gold-ink: #7A5A17; --gold-soft: #F5EDDA;
  --red: #8F2B1B; --red-soft: #F7E4DF;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --top-h: 64px; --filters-h: 64px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--sans); display: flex; flex-direction: column; overflow: hidden; }
h1, h2, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- top ---------- */
.top { display: flex; align-items: center; gap: 14px; padding: 10px 16px; background: var(--green); color: #fff; min-height: var(--top-h); }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: 1px; }
.brand img { border-radius: 6px; background: #fff; }
.top h1 { font: 700 24px/1.1 var(--serif); }
.top .sub { font-size: 13px; color: #D9E4DC; }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.filters label, .filters .range { display: flex; flex-direction: column; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.filters .pair { display: flex; align-items: center; gap: 4px; }
.filters .pair i { font-style: normal; color: var(--muted); }
.filters .pair select { min-width: 84px; }
.filters select { min-height: 40px; min-width: 120px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 15px; color: var(--ink); }
.count { margin-left: auto; font-size: 14px; color: var(--muted); align-self: center; }
.count b { color: var(--ink); }
.ftoggle { display: none; }

/* ---------- layout: list beside the map (desktop), map with a list toggle (phone) ---------- */
/* The list takes about five eighths of the width. Cards: photo on top, FOUR across on a desktop at 100%
   zoom (K, 22 Nov 2026). A column is at least a quarter of the list and at least 200px, so there are
   never more than four, and fewer only when the list is narrow. */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 5fr) minmax(320px, 3fr); position: relative; }
.list { overflow-y: auto; padding: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(max(200px, calc((100% - 36px) / 4)), 1fr));
  grid-auto-rows: max-content; align-content: start; gap: 12px; border-right: 1px solid var(--line); }
.list > .empty, .list > .more { grid-column: 1 / -1; }
.map { min-height: 0; background: #E8E6DF; }
.toggle { display: none; }

/* ---------- unit card ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--gold); box-shadow: 0 3px 12px rgba(0,0,0,.10); }
.card.clickable:hover .ph img { transform: scale(1.03); }
.card.hl { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.ph { position: relative; display: block; background: var(--green-soft); aspect-ratio: 4 / 3; overflow: hidden; }
.ph img { transition: transform .25s; }
a.bld { color: inherit; text-decoration: none; }
a.bld:hover { text-decoration: underline; }
.pin-btn { display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px !important; }
.actions .btn.primary { flex: 1; }
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ph .none { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--green-ink); text-align: center; padding: 8px; }
.body { padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.price { font-size: 18px; font-weight: 700; color: var(--green); }
.price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.facts { font-size: 14px; }
.bld { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.near, .conf { font-size: 12px; color: var(--muted); }
.conf.fresh { color: var(--green-ink); }
.actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: nowrap; }
.actions .btn { white-space: nowrap; }
.card.hero { border-color: var(--gold); }
.pick { position: absolute; top: 8px; left: 8px; background: var(--gold); color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 10px; letter-spacing: .3px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.btn { min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: 15px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.primary { background: var(--green); color: #fff; }
.btn.primary:hover { background: #17301F; }
.btn.primary[disabled] { opacity: .6; cursor: wait; }
.btn.ghost { background: #fff; border-color: var(--line-strong); color: var(--ink); }
.empty { padding: 24px 12px; text-align: center; color: var(--muted); }
.empty .btn { margin-top: 12px; }
.code { font: 500 11px/1 ui-monospace, Consolas, monospace; color: var(--muted); }
.more { text-align: center; }

/* ---------- agent map (inside the CRM): Offer to client on its own row, then Shortlist + pin ---------- */
.agent .actions { flex-wrap: wrap; }
.agent .actions [data-offer] { flex: 1 0 100%; }
.sl-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sl-btn.on { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
.card.in-tray { border-color: var(--gold); }
.tray { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 1300; display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 24px); padding: 8px 10px 8px 14px; background: var(--ink); color: #fff; border-radius: 12px; box-shadow: 0 4px 18px rgba(0,0,0,.3); }
.tray[hidden] { display: none; }
.tray-n { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--gold); }
.tray-n b { color: #fff; }
.tray-codes { font: 500 12px/1.3 ui-monospace, Consolas, monospace; opacity: .75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1 1 auto; max-width: 340px; }
.tray .btn { white-space: nowrap; }
.tray .btn.primary { background: var(--gold); color: var(--ink); }
.tray .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.agent .list { padding-bottom: 76px; }
@media (max-width: 820px) { .tray-codes { display: none; } .tray { bottom: 76px; } }

/* ---------- client catalogue: "Add to catalogue", its "?" tip, the bottom bar ---------- */
.cat-wrap { position: relative; flex: 1; display: flex; min-width: 0; }
.cat-btn { flex: 1; }
.cat-btn.on { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
.cat-q { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-strong); background: #fff; color: var(--green); font: 700 12px/18px var(--sans); text-align: center;
  cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.cat-q:hover, .cat-q:focus-visible { border-color: var(--green); }
/* A bigger touch target than it looks, without growing the dot. */
.cat-q::after { content: ''; position: absolute; inset: -10px; }
.cat-q.dark { position: relative; top: auto; right: auto; flex: none; background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.cat-tip { position: fixed; z-index: 1500; width: min(280px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 10px;
  background: var(--ink); color: #fff; font-size: 13px; line-height: 1.45; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.cat-tip b { display: block; color: var(--gold); margin-bottom: 2px; }
.has-cat .list { padding-bottom: 76px; }
.cat .tray-codes { font: 500 13px/1.3 var(--sans); }
.cat .cat-x { width: 36px; padding: 0 !important; font-size: 22px; line-height: 1; }
@media (max-width: 420px) { .cat { gap: 8px; padding: 8px 8px 8px 12px; } }
.toast { position: fixed; left: 50%; top: calc(var(--top-h) + 12px); transform: translateX(-50%); z-index: 1500; max-width: calc(100vw - 32px);
  padding: 10px 14px; border-radius: 10px; background: var(--red-soft); color: var(--red); border: 1px solid var(--red); font-size: 14px; }
.toast[hidden] { display: none; }
.enq-hint { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.enq-unit { flex-direction: column; max-height: 34vh; overflow-y: auto; }
.enq-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.enq-list li > div { display: inline-block; vertical-align: top; width: calc(100% - 40px); }
.enq-list .x { float: right; width: 36px; height: 36px; font-size: 22px; margin: -4px -6px 0 0; }

/* ---------- map pins ---------- */
.pin { background: var(--green); color: #fff; font: 700 12px/1 var(--sans); padding: 6px 8px; border-radius: 14px; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); border: 2px solid #fff; transform: translate(-50%, -50%); display: inline-block; }
.pin.on { background: var(--gold); }
.pin i { font-style: normal; font-weight: 500; opacity: .85; }
.leaflet-div-icon.pin-wrap { background: none; border: 0; }
.marker-cluster { background: rgba(31,61,43,.22); border-radius: 50%; }
.marker-cluster div { width: 32px; height: 32px; margin: 4px; border-radius: 50%; background: var(--green); color: #fff;
  font: 700 13px/32px var(--sans); text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.marker-cluster span { line-height: 32px; }
.leaflet-popup-content { margin: 12px 14px; font: 14px/1.4 var(--sans); }
.pop h3 { margin: 0 0 4px; font-size: 15px; }
.pop .approx { font-size: 12px; color: var(--muted); margin-top: 6px; }
.pop .btn { margin-top: 8px; width: 100%; }
.pop-ph { display: block; margin: -4px -6px 8px; border-radius: 8px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--green-soft); }
.pop-ph img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pop-units { display: flex; flex-direction: column; margin-top: 6px; border-top: 1px solid var(--line); }
.pop-unit { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--ink) !important; text-decoration: none; font-size: 13px; }
a.pop-unit:hover { color: var(--green) !important; text-decoration: underline; }

/* ---------- enquiry dialog ---------- */
.sheet { border: 0; padding: 0; border-radius: 14px; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--card); color: var(--ink); }
.sheet::backdrop { background: rgba(20, 24, 20, .5); }
.sheet-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font: 700 24px/1.15 var(--serif); color: var(--green); }
.x { width: 44px; height: 44px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--muted); }
.enq-unit { display: flex; gap: 10px; padding: 10px; background: var(--bg); border-radius: 10px; font-size: 14px; }
.enq-unit b { color: var(--green); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fld { display: flex; flex-direction: column; gap: 3px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fld small { font-weight: 400; }
.fld.wide { grid-column: 1 / -1; }
.fld input, .fld select, .fld textarea { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 16px; font-weight: 400; color: var(--ink); }
.fld textarea { resize: vertical; }
.fld .bad, .bad { border-color: var(--red) !important; }
em[data-err] { font-style: normal; font-size: 12px; font-weight: 500; color: var(--red); min-height: 0; }
em[data-err]:empty { display: none; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.consent input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--green); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-err { padding: 10px 12px; background: var(--red-soft); color: var(--red); border-radius: 8px; font-size: 14px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 10px; }
.done { align-items: center; text-align: center; padding: 32px 24px; }
.done .tick { width: 56px; height: 56px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 30px; display: grid; place-items: center; }
.ref { font-weight: 600; color: var(--gold-ink); }

/* ---------- inside the website (?embed=1): the website's own header is above ---------- */
.embed .top { display: none; }

/* ---------- phone ---------- */
@media (max-width: 820px) {
  .top { padding: 8px 16px; min-height: 56px; }
  .top h1 { font-size: 20px; }
  .top .sub { font-size: 12px; }
  /* Filters: a "Filters" button and Sort on one row; the button folds the rest open as a
     two-column panel (no sideways scrolling). */
  .filters { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 10px; padding: 8px 16px 10px; }
  .filters > * { order: 2; min-width: 0; }
  .filters > .ftoggle, .filters > .fsort { order: 1; }
  .filters:not(.open) > :not(.ftoggle):not(.fsort) { display: none; }
  .ftoggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px;
    border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; font-size: 15px; font-weight: 600; color: var(--ink); }
  .ftoggle[aria-expanded="true"] { background: var(--green-soft); border-color: var(--green); color: var(--green); }
  .ftoggle b { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--green); color: #fff; font-size: 12px; line-height: 20px; }
  .filters label span { font-size: 12px; }
  .filters select { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; padding: 6px 8px; }
  .filters .pair select { min-width: 0; flex: 1; padding: 6px 2px 6px 6px; font-size: 15px; }
  .actions { flex-wrap: wrap; }
  .count { display: none; }
  .layout { grid-template-columns: 1fr; }
  .list { grid-template-columns: 1fr; position: absolute; inset: 0; z-index: 1100; background: var(--bg); border: 0; padding: 12px 16px 88px; }
  .layout[data-view="map"] .list { display: none; }
  .toggle { display: block; position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1200;
    min-height: 48px; padding: 10px 22px; border-radius: 24px; border: 0; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
  .sheet { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .grid { grid-template-columns: 1fr; }
  .sheet-foot { position: sticky; bottom: 0; background: var(--card); padding-top: 8px; }
  .sheet-foot .btn { flex: 1; }
}
