/* ===== Map app: full-screen map with a floating sheet, iPad-style =====
   Two colours: bluestone blue + marigold. System font (San Francisco on iPhone/iPad/Mac). */
:root {
  /* navy & gold */
  --blue: #f4b23e; --blue-d: #172a45; --blue-l: rgba(244, 178, 62, .14);   /* "blue" = the accent, now gold */
  --gold: #f4b23e; --gold-d: #d9951c; --gold-l: rgba(244, 178, 62, .14);
  --night: #0f1a2b; --night-2: #0a1322; --surface: #19273d; --surface-2: #213250; --sun: #3f6aa8; --good: #4fd18f;
  --ink: #eef2f8; --ink-2: #b4c0d2; --muted: #8494ab;
  --sep: #2a3b57; --fill: #213250; --fill-2: #2a3b57;
  --glass: rgba(15, 26, 43, .9);
  --shadow: 0 14px 44px rgba(0, 0, 0, .45), 0 0 0 1px #2a3b57;
  --font: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
  --sheet-w: 392px;
  --gap: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body.app { font: 15px/1.4 var(--font); color: var(--ink); background: var(--night); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2.5px solid var(--gold-d); outline-offset: 2px; }

/* frosted glass surfaces */
.glass { background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: rgba(15, 26, 43, .98); } }

#map { position: fixed; inset: 0; z-index: 0; }
.leaflet-container { background: #e8e6e1; font-family: var(--font); }
.leaflet-control-attribution { font-size: 10px; background: rgba(10, 19, 34, .8) !important; color: var(--muted) !important; border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: var(--ink-2) !important; }

/* ---------- top-right buttons ---------- */
.topbar { position: fixed; top: calc(var(--gap) + env(safe-area-inset-top)); right: var(--gap); z-index: 500; display: flex; gap: 10px; }
.gbtn { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 15px; white-space: nowrap; }
.gbtn svg { width: 19px; height: 19px; }
.gbtn.glass { color: var(--ink); }
.gbtn.gold { background: var(--gold); color: var(--blue-d); box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
.gbtn.gold:hover { background: #f7bd55; }
.gbtn.glass:hover { background: var(--surface-2); }

/* ---------- map controls ---------- */
.mapctl { position: fixed; right: var(--gap); bottom: calc(var(--gap) + 18px + env(safe-area-inset-bottom)); z-index: 500; display: flex; flex-direction: column; gap: 10px; }
.mapctl > button, .zoom { border-radius: 12px; border: 0; }
.mapctl button { width: 44px; height: 44px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; color: var(--blue); }
.mapctl > button.glass { background: var(--glass); }
.mapctl svg { width: 21px; height: 21px; }
.mapctl .fill { fill: currentColor; }
.zoom { display: flex; flex-direction: column; overflow: hidden; }
.zoom button + button { border-top: 1px solid var(--sep); }

/* ---------- the sheet ---------- */
.sheet { position: fixed; z-index: 600; top: var(--gap); left: var(--gap); bottom: var(--gap); width: var(--sheet-w); border-radius: 22px; display: flex; flex-direction: column; overflow: hidden; }
.grab { display: none; }
.view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.view > *:not(.list) { flex: none; } /* only the list may shrink/scroll; everything else keeps its height */

.sh-head { padding: 16px 18px 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: auto; height: 64px; object-fit: contain; }
.brand span { font-size: 20px; font-weight: 800; letter-spacing: -.02em; color: #fff; }

.search { margin: 0 14px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 11px; background: var(--fill); color: var(--muted); }
.search svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { opacity: .5; }

/* iOS segmented control */
.seg { margin: 12px 14px 0; display: grid; grid-template-columns: repeat(4, 1fr); padding: 2px; border-radius: 10px; background: var(--fill); }
.seg button { border: 0; background: none; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink); }
.seg button.on { background: var(--gold); color: var(--blue-d); font-weight: 700; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }

.filters { display: flex; gap: 8px; margin: 10px 14px 0; }
.sel { position: relative; flex: 1; min-width: 0; }
.sel select { width: 100%; appearance: none; -webkit-appearance: none; height: 36px; border: 0; border-radius: 10px; background: var(--fill); padding: 0 30px 0 12px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; text-overflow: ellipsis; }
.sel select option { background: var(--surface); }
.sel::after { content: ''; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }
.sel.on select { background: var(--gold); color: var(--blue-d); font-weight: 700; }
.sel.on::after { border-color: var(--blue-d); }

.count { display: flex; justify-content: space-between; align-items: center; margin: 16px 18px 6px; font-size: 13px; color: var(--muted); }
.count b { font-size: 15px; color: var(--ink); font-weight: 700; }
.legend { display: inline-flex; align-items: center; gap: 4px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 6px; }

/* day colours */
.d-sat { --day: var(--gold); --day-ink: var(--blue-d); --day-soft: #3a3424; }
.d-sun { --day: var(--sun); --day-ink: #fff; --day-soft: #23385a; }
.d-wk  { --day: #6b7a92; --day-ink: #fff; --day-soft: #253147; }
.legend i { background: var(--day); }

.list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 8px 8px; }
.row { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; cursor: pointer; position: relative; }
.row:hover, .row.hl { background: var(--surface); }
.row + .row::before, .adrow + .row::before, .row + .adrow::before { content: ''; position: absolute; left: 94px; right: 10px; top: 0; border-top: 1px solid var(--sep); }
.row.hl::before, .row.hl + .row::before, .row:hover::before, .row:hover + .row::before { border-color: transparent; }
.thumb { position: relative; width: 72px; height: 72px; }
.thumb img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; display: block; background: var(--fill); }
.num { position: absolute; top: -5px; left: -5px; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 12px; background: var(--day); color: var(--day-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }
.r-main { min-width: 0; }
.r-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.r-sub { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-when { font-size: 13.5px; font-weight: 600; color: var(--gold); margin-top: 3px; display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0; }
.r-when span:last-child { overflow: hidden; text-overflow: ellipsis; }
.badge { flex: none; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--gold); color: var(--blue-d); }
.badge.now { background: var(--blue); color: #fff; }
.badge.cancel { background: #6b7280; color: #fff; }
.row.cancelled .r-title { text-decoration: line-through; color: var(--muted); }
.addbtn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fill); color: var(--blue); display: grid; place-items: center; cursor: pointer; }
.addbtn svg { width: 18px; height: 18px; stroke-width: 2.4; }
.addbtn.on { background: var(--gold); color: var(--blue-d); }

/* sponsored row in the list */
.adrow { display: block; margin: 6px 2px 10px; border-radius: 16px; overflow: hidden; text-decoration: none; background: var(--surface); box-shadow: 0 0 0 1px var(--sep); position: relative; }
.adrow img { width: 100%; aspect-ratio: 2.4 / 1; object-fit: cover; display: block; }
.ad-b { padding: 10px 12px 12px; }
.ad-tag { font-size: 11px; font-weight: 600; color: var(--muted); }
.ad-h { font-size: 15px; font-weight: 700; margin-top: 2px; }
.ad-t { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.ad-cta { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--gold); }
.ad-h { color: #fff; }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty b { display: block; font-size: 17px; color: var(--ink); margin-bottom: 6px; }
.empty .pbtn { margin-top: 14px; }

.sh-foot { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 12px 18px 14px; border-top: 1px solid var(--sep); font-size: 13px; }
.sh-foot a { color: var(--blue); text-decoration: none; font-weight: 500; }
.sh-foot a:hover { text-decoration: underline; }

/* ---------- detail view ---------- */
.detail { overflow-y: auto; overscroll-behavior: contain; }
.d-top { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 12px 12px 8px; }
.d-back, .d-close { height: 34px; border: 0; border-radius: 17px; background: rgba(15, 26, 43, .85); box-shadow: 0 0 0 1px var(--sep); display: inline-flex; align-items: center; gap: 2px; padding: 0 12px 0 6px; font-size: 15px; font-weight: 600; color: var(--blue); cursor: pointer; }
.d-back svg { width: 20px; height: 20px; }
.d-close { width: 34px; padding: 0; justify-content: center; }
.d-close svg { width: 16px; height: 16px; stroke-width: 2.6; }
.gallery { margin-top: -54px; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { flex: none; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; scroll-snap-align: start; background: var(--fill); }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: -22px; position: relative; z-index: 1; height: 22px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .55); box-shadow: 0 0 2px rgba(0, 0, 0, .3); }
.dots i.on { background: #fff; }
.d-body { padding: 16px 18px 24px; }
.d-title { color: #fff; font-size: 24px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; margin: 0; }
.d-addr { color: var(--ink-2); margin-top: 4px; font-size: 15px; }
.d-badges { display: flex; gap: 6px; margin-top: 8px; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px; border-radius: 12px; border: 0; background: var(--fill); color: var(--blue); font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
.act svg { width: 22px; height: 22px; }
.act.primary { background: var(--gold); color: var(--blue-d); }
.act.on { background: var(--gold); color: var(--blue-d); }
.group { background: var(--surface); border-radius: 14px; overflow: hidden; margin-bottom: 14px; box-shadow: 0 0 0 1px var(--sep); }
.group-h { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 4px 6px; }
.gi { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.gi + .gi { border-top: 1px solid var(--sep); }
.gi .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--day); flex: none; }
.gi b { font-weight: 600; flex: 1; }
.gi span { color: var(--ink-2); }
.gi.past { opacity: .45; }
.gi svg { width: 20px; height: 20px; color: var(--gold); flex: none; }
.gi b { color: #fff; }
.gi a { color: var(--blue); font-weight: 600; text-decoration: none; }
.d-desc { font-size: 15.5px; line-height: 1.55; margin: 0 0 14px; padding: 14px; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--sep); white-space: pre-line; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tags span { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; padding: 7px 11px 7px 9px; border-radius: 9px; background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--sep); }
.tags span svg { width: 17px; height: 17px; color: var(--gold); }
.d-link { display: block; text-align: center; padding: 12px; border-radius: 12px; color: var(--blue); font-weight: 600; text-decoration: none; background: var(--fill); }

/* ---------- map pins: round markers in the day colour ---------- */
.mk { width: 34px; height: 42px; position: relative; transform-origin: 50% 100%; transition: transform .15s; }
.mk b { position: absolute; top: 0; left: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--day); color: var(--day-ink); border: 2.5px solid var(--night-2); display: grid; place-items: center; font: 700 13px var(--font); box-shadow: 0 3px 8px rgba(0, 0, 0, .3); }
.mk::after { content: ''; position: absolute; left: 50%; bottom: 1px; width: 10px; height: 10px; margin-left: -5px; background: var(--night-2); transform: rotate(45deg); border-radius: 0 0 3px 0; box-shadow: 2px 2px 3px rgba(0, 0, 0, .15); z-index: -1; }
.mk.sel { transform: scale(1.3); z-index: 1000; }
.mk.sel b { box-shadow: 0 0 0 4px rgba(255, 255, 255, .55), 0 4px 10px rgba(0, 0, 0, .5); }
.mk.route b { border-color: #fff; }
.mk.cancelled b { background: #4a5568; color: #cbd2dd; }
.me { width: 18px; height: 18px; border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(10, 132, 255, .2), 0 2px 4px rgba(0, 0, 0, .3); }

/* ---------- sponsored card on the map ---------- */
.mapad { position: fixed; z-index: 500; right: calc(var(--gap) + 58px); bottom: calc(var(--gap) + 18px + env(safe-area-inset-bottom)); width: 300px; border-radius: 18px; overflow: hidden; }
.mapad a { display: block; text-decoration: none; }
.mapad img { width: 100%; aspect-ratio: 2.4 / 1; object-fit: cover; display: block; }
.mapad .ad-b { padding: 10px 14px 12px; }
.mapad-x { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .45); color: #fff; display: grid; place-items: center; cursor: pointer; }
.mapad-x svg { width: 12px; height: 12px; stroke-width: 3; }
.mapad.fade { animation: adfade .5s; }
@keyframes adfade { from { opacity: 0; transform: translateY(6px); } }

/* ---------- route bar ---------- */
.routebar { position: fixed; z-index: 700; left: calc(var(--sheet-w) + var(--gap) * 2); right: calc(var(--gap) + 58px + 316px); bottom: calc(var(--gap) + 18px + env(safe-area-inset-bottom)); max-width: 560px; min-width: 300px; margin: 0 auto; border-radius: 16px; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; }
.rb-txt { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rb-txt b { color: var(--gold); }
.rb-clear { border: 0; background: none; color: var(--ink-2); font-weight: 600; cursor: pointer; padding: 8px; }
.rb-go { background: var(--gold); color: var(--blue-d); text-decoration: none; font-weight: 600; padding: 10px 16px; border-radius: 10px; white-space: nowrap; }

.pbtn { display: inline-block; background: var(--gold); color: var(--blue-d); font-weight: 700; padding: 10px 18px; border-radius: 12px; text-decoration: none; border: 0; cursor: pointer; }
.pbtn.ghost { background: var(--fill); color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 10px); background: var(--gold); color: var(--blue-d); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; opacity: 0; transition: .2s; z-index: 2000; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- iPad portrait / small laptops ---------- */
@media (max-width: 1180px) { .mapad { width: 260px; } .routebar { right: calc(var(--gap) + 58px); } }
@media (max-width: 980px) { :root { --sheet-w: 360px; } .mapad { display: none; } .gbtn.glass span { display: none; } .gbtn.glass { padding: 0 12px; } }

/* ---------- phones: bottom sheet you drag up and down ---------- */
@media (max-width: 700px) {
  :root { --gap: 10px; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: auto; height: calc(100% - 64px - env(safe-area-inset-top)); border-radius: 18px 18px 0 0; transform: translateY(var(--sheet-y, 55%)); transition: transform .32s cubic-bezier(.2, .8, .2, 1); will-change: transform; padding-bottom: env(safe-area-inset-bottom); }
  .sheet.dragging { transition: none; }
  .grab { display: block; padding: 7px 0 2px; cursor: grab; touch-action: none; }
  .grab i { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 0 auto; }
  .sh-head { display: none; }
  .search { margin-top: 6px; }
  .topbar { left: var(--gap); right: var(--gap); justify-content: space-between; }
  .topbar::before { content: ''; }
  .gbtn { height: 40px; font-size: 14px; }
  .gbtn.glass span { display: inline; }
  .mapctl { bottom: auto; top: calc(64px + env(safe-area-inset-top)); }
  .mapctl .zoom { display: none; }
  .routebar { left: var(--gap); right: var(--gap); min-width: 0; top: calc(64px + env(safe-area-inset-top)); bottom: auto; margin-right: 58px; }
  .toast { bottom: auto; top: 70px; }
  .d-top { position: sticky; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.mk.hover { transform: scale(1.15); z-index: 900; }

/* ---- day groups + rows (time tile, suburb, what's for sale icons) ---- */
.gh { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: baseline; padding: 14px 10px 8px; background: linear-gradient(var(--glass) 70%, transparent); }
.gh b { font-size: 15px; color: #fff; }
.gh span { font-size: 13px; color: var(--muted); font-weight: 600; }
.row { grid-template-columns: 74px 1fr auto; }
.row + .row::before, .adrow + .row::before, .row + .adrow::before { left: 96px; }
.gh + .row::before { display: none; }
.tt { position: relative; width: 74px; height: 62px; border-radius: 12px; background: var(--day-soft); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.tt b { font-size: 15.5px; color: #fff; letter-spacing: -.01em; }
.tt > span:last-child { font-size: 11.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.tt .num { position: absolute; top: -6px; left: -6px; }
.r-sub em { font-style: normal; font-weight: 700; color: var(--good); margin-left: 4px; }
.r-sub em::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 5px; vertical-align: 1px; }
.r-sub em.x { color: #ff8a80; } .r-sub em.x::before { background: #ff8a80; }
.r-sub i { font-style: normal; color: var(--muted); font-size: 12.5px; margin-left: 4px; }
.r-ic { display: flex; gap: 8px; margin-top: 7px; color: var(--gold); }
.r-ic svg { width: 17px; height: 17px; }
.r-title { color: #fff; }
.num { border-color: var(--night); }
.empty b { color: #fff; }

/* sale detail without photos */
.d-hero { margin-top: -54px; padding: 62px 18px 20px; display: flex; align-items: center; gap: 16px; background: var(--day-soft); }
.d-tile { width: 70px; height: 78px; border-radius: 14px; background: var(--day); color: var(--day-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: none; }
.d-tile span { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.d-tile b { font-size: 32px; font-weight: 800; letter-spacing: -.04em; margin: 3px 0; }
.d-hero > div:last-child b { display: block; font-size: 19px; color: #fff; }
.d-hero > div:last-child span { color: var(--ink-2); }
.sh-foot a { color: var(--gold); }
.search input { color: var(--ink); }
.ad-tag { color: var(--muted); }
.ad-t { color: var(--ink-2); }
.badge { background: var(--gold); color: var(--blue-d); }
.badge.now { background: rgba(79, 209, 143, .16); color: var(--good); }
.badge.cancel { background: #3b4558; color: #fff; }

/* brand logo in the panel */
.sh-head .brand img { width: auto; height: 64px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
