:root {
  --lake: #2E6F8E;
  --lake-ink: #1F5570;
  --lake-wash: #E3EEF3;
  --ink: #1D2430;
  --ink-2: #3E4757;
  --paper: #F7F8F6;
  --card: #FFFFFF;
  --line: #D8DEE3;
  --badger: #C5050C;
  --warn: #9A5B00;
  --warn-wash: #FFF4DF;
  --p1: #127A73; --p2: #5E9E3A; --p3: #C9961A; --p4: #C2185B; --p5: #5B2A86; --p0: #7C8796;
  --radius-s: 6px;
  --radius-l: 12px;
  --rail: 384px;
  --shadow: 0 8px 28px rgba(22, 40, 56, .18);
  --on-accent: #FFFFFF;
  color-scheme: light;
}
/* Light is the default; dark only when chosen in the Appearance menu (theme.js sets data-theme) */
:root[data-theme="dark"] {
  --lake: #6FB3D2; --lake-ink: #9FD0E6; --lake-wash: #18313D;
  --ink: #E7ECF1; --ink-2: #C3CCD6; --paper: #10161D; --card: #18212B; --line: #2C3846;
  --badger: #FF5A5F; --warn: #F2B356; --warn-wash: #3A2B12;
  --p1: #3FC1B5; --p2: #8CCB5E; --p3: #E9BE4A; --p4: #F0629A; --p5: #B38BE6; --p0: #8592A3;
  --shadow: 0 8px 28px rgba(0, 0, 0, .5);
  --on-accent: #10161D;
  color-scheme: dark;
}
/* Accent choices (Appearance menu); --lake* names kept for the accent role */
:root[data-accent="red"] { --lake: #C5050C; --lake-ink: #9B0309; --lake-wash: #FBEAEB; }
:root[data-theme="dark"][data-accent="red"] { --lake: #FF6B70; --lake-ink: #FF9DA0; --lake-wash: #3B1618; }
:root[data-accent="pine"] { --lake: #2E7D4F; --lake-ink: #1E5C39; --lake-wash: #E3F1E8; }
:root[data-theme="dark"][data-accent="pine"] { --lake: #6FCF97; --lake-ink: #A3E3BC; --lake-wash: #16301F; }
:root[data-accent="dusk"] { --lake: #6A4FB8; --lake-ink: #4D3590; --lake-wash: #ECE7F8; }
:root[data-theme="dark"][data-accent="dusk"] { --lake: #A794F2; --lake-ink: #C9BCF8; --lake-wash: #261C40; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 15px/1.45 "Instrument Sans", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lake); outline-offset: 2px; }
a { color: var(--lake-ink); }

/* Header */
.top {
  height: 56px; flex: none; display: flex; align-items: center; gap: 24px; position: relative; z-index: 1000;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.top-right { position: relative; }
.appearance-panel {
  position: absolute; top: calc(100% + 10px); right: 0; width: 260px; z-index: 1100;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 12px;
}
.ap-row { display: grid; gap: 6px; }
.ap-lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ap-seg { display: flex; }
.ap-seg button { flex: 1; }
.swatches { display: flex; gap: 10px; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.wordmark { font: italic 400 28px/1 "Instrument Serif", Georgia, serif; color: var(--lake-ink); letter-spacing: -.01em; }
.tabs { display: flex; gap: 4px; }
.tab {
  border: 0; background: none; padding: 8px 12px; border-radius: var(--radius-s);
  font-weight: 600; color: var(--ink-2);
}
.tab.active { background: var(--lake-wash); color: var(--lake-ink); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.stat { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.stat b { color: var(--ink); font-weight: 600; }
.lang { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-s); padding: 5px 10px; font-size: 13px; }
.ap-btn { display: inline-flex; align-items: center; gap: 6px; }

/* Views */
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; }

/* Rail */
.rail {
  width: var(--rail); flex: none; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: var(--card);
}
.filters { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; }
#q {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--paper);
}
.field { display: grid; gap: 6px; }
.field.two { grid-template-columns: 1fr 1fr; gap: 10px; }
.field.two label { display: grid; gap: 4px; }
.lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.lbl b { color: var(--ink); }
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
select { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); min-width: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button, .seg button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  padding: 4px 11px; font-size: 13px; font-weight: 500;
}
.chips button.on { background: var(--lake); border-color: var(--lake); color: var(--on-accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 3px 10px; font-size: 12px; }
.seg button.on { background: var(--ink); color: var(--paper); }
input[type=range] { width: 100%; accent-color: var(--lake); }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 34px; height: 20px; border-radius: 999px; background: var(--line); position: relative;
  transition: background-color .15s ease;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--card); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s ease;
}
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:focus-visible { outline: 2px solid var(--lake); outline-offset: 2px; }
.checks input[type=checkbox] { accent-color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .switch input, .switch input::after { transition: none; } }
.units tr.shared td { background: var(--paper); }
.hidden-note { font-size: 13px; color: var(--ink-2); margin: 6px 0 0; }
.linkish { border: 0; background: none; padding: 0; color: var(--lake-ink); font-size: 13px; text-decoration: underline; text-underline-offset: 2px; justify-self: start; }
.more summary { font-size: 13px; font-weight: 600; color: var(--lake-ink); cursor: pointer; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 8px 0; font-size: 13px; }
.checks label { display: flex; gap: 6px; align-items: center; }
.ll { display: grid; gap: 4px; }
.result-bar { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.result-bar #count { font-weight: 600; }
.bar-actions { display: flex; gap: 12px; }

/* Results */
.results { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.res {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 4px 10px; align-items: start;
  padding: 11px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.res:hover, .res.sel { background: var(--lake-wash); }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; border: 2px solid transparent; }
.dot.p0 { background: transparent; border-color: var(--p0); }
.res h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.res .sub { grid-column: 2; font-size: 13px; color: var(--ink-2); }
.res .sub > span { display: block; }
.nw { white-space: nowrap; }
.res .price { grid-column: 3; grid-row: 1 / span 2; text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; }
.res .price small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-2); }
.res .price.none { font-weight: 500; font-size: 13px; color: var(--ink-2); }
.tags { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--paper); border: 1px solid var(--line); }
.tag.t2728 { border-color: var(--lake); color: var(--lake-ink); }
.tag.gap { background: var(--warn-wash); border-color: transparent; color: var(--warn); }
.tag.metric { background: var(--lake-wash); border-color: transparent; color: var(--lake-ink); font-weight: 600; }
.empty { padding: 24px 16px; color: var(--ink-2); }

/* Map */
.mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--paper); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; line-height: 1.5; }
/* Leaflet's plus-lighter tile blending leaves hairline seams on high-DPI screens */
.leaflet-container img.leaflet-tile { mix-blend-mode: normal; }
/* Color basemap at night: invert lightness, keep hues */
.leaflet-layer.bm-night { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.9) saturate(.75); }
.leaflet-layer.bm-dim { filter: brightness(.8); }
.legend {
  position: absolute; left: 12px; bottom: 22px; z-index: 500; background: var(--card); color: var(--ink);
  border-radius: var(--radius-s); padding: 8px 10px; box-shadow: var(--shadow); font-size: 12px; display: grid; gap: 3px;
}
.legend b { font-size: 12px; }
.lg-head { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 700; color: var(--ink); text-align: left; display: flex; gap: 6px; align-items: center; }
.lg-head::after { content: "▾"; color: var(--ink-2); }
.legend.closed .lg-head::after { content: "▸"; }
.lg-body { display: grid; gap: 3px; margin-top: 4px; }
.legend.closed .lg-body { display: none; }
.more-n { color: var(--lake-ink); }
.fbody { display: contents; }
.ftoggle {
  display: none; align-items: center; justify-content: space-between; width: 100%;
  border: 1px solid var(--line); background: var(--paper); border-radius: var(--radius-s);
  padding: 8px 12px; font-size: 14px; font-weight: 600; text-align: left;
}
.ftoggle::after { content: "▾"; color: var(--ink-2); }
.filters.open .ftoggle::after { content: "▴"; }
.viewswitch { display: none; }
.legend .row { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.pick-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 600;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 999px; font-size: 13px;
}
.price-tag {
  background: var(--card); color: var(--ink); border: 2px solid var(--c, var(--p0)); border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 0 6px; line-height: 18px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.25); transform: translate(-50%, -50%); display: inline-block;
}
.price-tag.none { font-weight: 500; color: var(--ink-2); border-style: dashed; }
/* Selected: whole tag inverts */
.price-tag { cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.price-tag.sel { background: var(--ink); color: var(--paper); border-color: var(--ink); border-style: solid; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.campus-pin { width: 16px; height: 16px; background: var(--badger); transform: rotate(45deg); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--badger); }
.ring-label { color: var(--badger); font-size: 11px; font-weight: 600; white-space: nowrap; text-shadow: 0 0 3px var(--card), 0 0 3px var(--card); }

/* Drawer */
.drawer {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(460px, calc(100% - 24px));
  background: var(--card); border-radius: var(--radius-l); box-shadow: var(--shadow); z-index: 700;
  overflow-y: auto; padding: 18px 20px 24px;
}
.dhead {
  position: sticky; top: -18px; z-index: 3; display: flex; align-items: flex-start; gap: 12px;
  margin: -18px -20px 4px; padding: 16px 20px 8px; background: var(--card); border-bottom: 1px solid transparent;
}
/* Hairline under the pinned title once the drawer scrolls (static where scroll timelines are unsupported) */
@supports (animation-timeline: scroll()) {
  .dhead { animation: dhead-line linear both; animation-timeline: scroll(nearest block); animation-range: 0 32px; }
  @keyframes dhead-line { to { border-bottom-color: var(--line); } }
}
.drawer .close { flex: none; margin-left: auto; border: 0; background: var(--paper); border-radius: 50%; width: 32px; height: 32px; font-size: 18px; line-height: 1; }
.drawer h2 { font-size: 22px; line-height: 1.2; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.overview { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.overview span { font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); }
.overview span:first-child { background: var(--lake-wash); border-color: transparent; color: var(--lake-ink); }
.ugroup { border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 8px; }
.ugroup > summary { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; cursor: pointer; list-style: none; }
.ugroup > summary::-webkit-details-marker { display: none; }
.ugroup > summary::before { content: "▸"; color: var(--ink-2); font-size: 12px; transition: transform .15s; }
.ugroup[open] > summary::before { transform: rotate(90deg); }
.ugroup > summary b { font-size: 14px; white-space: nowrap; }
.ugroup > summary span { font-size: 13px; color: var(--ink-2); }
.ugroup .units { margin: 0; }
.ugroup .units td { padding-left: 12px; padding-right: 8px; }
.ugroup .units tr:last-child td { border-bottom: 0; }
.drawer .addr { color: var(--ink-2); margin: 0 0 10px; }
.contact { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; margin-bottom: 12px; }
.walk { background: var(--lake-wash); border-radius: var(--radius-s); padding: 8px 12px; font-size: 14px; margin-bottom: 14px; }
.walk b { color: var(--lake-ink); }
.photos { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px 14px; padding: 0 20px; }
.photos img { height: 110px; border-radius: var(--radius-s); flex: none; background: var(--paper); }
.drawer h4 { font-size: 14px; margin: 18px 0 8px; }
.facts { display: grid; grid-template-columns: 112px 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; }
.nostate { color: var(--warn); border-bottom: 1px dashed var(--warn); }
.prov { font-size: 11px; font-weight: 600; padding: 0 5px; border-radius: 3px; margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.prov.official { background: var(--lake-wash); color: var(--lake-ink); }
.prov.uw { border: 1px solid var(--badger); color: var(--badger); }
.prov.inferred { border: 1px dashed var(--ink-2); color: var(--ink-2); }
.prov.absent { border: 1px dashed var(--warn); color: var(--warn); }
.units { width: 100%; border-collapse: collapse; font-size: 13px; }
.units .u-when { white-space: nowrap; }
.units .u-rent, .units .u-size { white-space: nowrap; }
.units th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 4px 6px 4px 0; }
.units td { border-bottom: 1px solid var(--line); padding: 5px 6px 5px 0; vertical-align: top; }
.units td.r, .units th.r { text-align: right; }
.units .muted { color: var(--ink-2); font-size: 12px; }
.basis { font-size: 11px; font-weight: 600; }
.bv { font-size: 10.5px; font-weight: 600; padding: 0 4px; border-radius: 3px; white-space: nowrap; text-decoration: none; }
.bv.text, .bv.policy, .bv.manual { background: var(--lake-wash); color: var(--lake-ink); }
.bv.uw { border: 1px solid var(--badger); color: var(--badger); }
.bv.price, .bv.rule { border: 1px dashed var(--ink-2); color: var(--ink-2); }
.bv.none { background: var(--warn-wash); color: var(--warn); }
.units .muted.unv { color: var(--warn); }
.basis.bed { color: var(--lake-ink); }
.basis.unit { color: var(--ink-2); }
.units tr.flagged td:first-child { box-shadow: inset 3px 0 0 var(--warn); padding-left: 6px; }
.issues { background: var(--warn-wash); border-radius: var(--radius-s); padding: 10px 12px; font-size: 14px; }
.issues p { margin: 0 0 4px; }
.issues ul { margin: 4px 0 0; padding-left: 18px; }
.desc { font-size: 14px; color: var(--ink-2); white-space: pre-line; }
.srcs { padding-left: 18px; font-size: 14px; margin: 0; }

/* Gaps view */
.gaps-layout { display: flex; flex: 1; min-height: 0; }
.gaps-list { width: 420px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); background: var(--card); padding: 16px; }
.gaps-intro { margin: 0 0 12px; color: var(--ink-2); max-width: 60ch; }
#gap-landlords { list-style: none; margin: 0; padding: 0; }
#gap-landlords li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; border-radius: var(--radius-s); cursor: pointer; }
#gap-landlords li:hover, #gap-landlords li.sel { background: var(--lake-wash); }
#gap-landlords li .done { color: var(--p1); font-size: 12px; font-weight: 600; }
#gap-landlords li span:last-child { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.gaps-detail { flex: 1; overflow-y: auto; padding: 20px 28px 40px; }
.gaps-detail h2 { margin: 0 0 6px; font-size: 24px; }
.gaps-detail .q { list-style: none; padding: 0; margin: 0 0 16px; }
.gaps-detail .q li { padding: 4px 0; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 18px; align-items: center; }
.btn { border: 1px solid var(--lake); background: var(--lake); color: var(--on-accent); border-radius: var(--radius-s); padding: 7px 14px; font-weight: 600; }
.btn.ghost { background: none; color: var(--lake-ink); }
.gtable { border-collapse: collapse; width: 100%; font-size: 14px; }
.gtable th { text-align: left; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 6px 10px 6px 0; }
.gtable td { border-bottom: 1px solid var(--line); padding: 7px 10px 7px 0; vertical-align: top; }
.gtable a { cursor: pointer; }
textarea.draft { width: 100%; min-height: 260px; font: 13px/1.5 "Instrument Sans", sans-serif; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }

/* Sources view */
.sources { flex: 1; overflow-y: auto; padding: 24px 28px 48px; }
.sources > * { max-width: 920px; }
.sources h2 { font-size: 24px; margin: 0 0 8px; }
.sources p { max-width: 70ch; }
.sources table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 10px 0 24px; }
.sources th, .sources td { text-align: left; border-bottom: 1px solid var(--line); padding: 6px 12px 6px 0; vertical-align: top; }
.sources td.r { text-align: right; }

/* Mobile */
@media (max-width: 860px) {
  body { overflow: hidden; }
  .top { height: auto; flex-wrap: nowrap; gap: 8px; padding: 8px 10px; overflow-x: auto; scrollbar-width: none; }
  .top::-webkit-scrollbar { display: none; }
  .brand { flex: none; }
  .wordmark { font-size: 22px; }
  .ap-btn span { display: none; }
  .top .ap-btn { padding: 5px 8px; }
  #admin-link { display: none; }
  .tabs { gap: 2px; flex: none; }
  .tab { padding: 6px 7px; font-size: 14px; white-space: nowrap; }
  .top-right { margin-left: auto; gap: 6px; flex: none; position: static; }
  .top .lang { padding: 4px 8px; font-size: 12px; white-space: nowrap; }
  .appearance-panel { position: fixed; top: 52px; right: 10px; }
  #view-map.active { flex-direction: column; }
  .mapwrap { flex: 1; min-height: 0; }
  .rail { display: none; width: 100%; border-right: 0; flex: 1; min-height: 0; overflow-y: auto; }
  body.m-list .rail { display: flex; }
  body.m-list .mapwrap { display: none; }
  body.m-drawer .mapwrap { display: block; }
  .results { overflow: visible; flex: none; padding-bottom: 96px; }
  .legend { left: 10px; bottom: 96px; }
  .drawer { position: fixed; inset: 0; width: auto; border-radius: 0; z-index: 1300; }
  .viewswitch {
    display: block; position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 1200;
    background: var(--ink); color: var(--paper); border: 0; border-radius: 999px; padding: 11px 20px;
    font-weight: 600; font-size: 14px; box-shadow: var(--shadow); white-space: nowrap;
  }
  body.m-drawer .viewswitch { display: none; }
  .gaps-layout { flex-direction: column; overflow-y: auto; }
  .gaps-list { width: 100%; border-right: 0; overflow: visible; }
  .gaps-detail { padding: 16px; overflow: visible; }
  .sources { padding: 16px; }
  .checks { grid-template-columns: 1fr; }
  .ftoggle { display: flex; }
  .fbody { display: grid; gap: 12px; }
  .filters:not(.open) .fbody { display: none; }
  /* Unit rows as two-line cards: what + source / size + move-in, rent on the right */
  .ugroup .units, .ugroup .units tbody { display: block; }
  .ugroup .units tr { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .ugroup .units tr:last-child { border-bottom: 0; }
  .ugroup .units td { display: block; border: 0; padding: 0; width: auto; }
  .ugroup .units .u-what { grid-column: 1 / 3; grid-row: 1; }
  .ugroup .units .u-size { grid-column: 1; grid-row: 2; white-space: nowrap; }
  .ugroup .units .u-when { grid-column: 2; grid-row: 2; white-space: normal; }
  .ugroup .units .u-rent { grid-column: 3; grid-row: 1 / span 2; }
  .ugroup .units .u-what .src, .ugroup .units .u-size .muted, .ugroup .units .u-when .muted { display: inline; margin-left: 6px; }
  .ugroup .units .u-when .muted { white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
.bv.context, .bv.ladder, .bv.same, .bv.range { border: 1px dashed var(--ink-2); color: var(--ink-2); }
.bv.range-out { background: var(--warn-wash); color: var(--warn); }

/* Bus stops */
.bus-stop {
  display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; flex: none;
  background: #24476B; color: #fff; box-shadow: 0 0 0 1.5px #fff, 0 1px 3px rgba(0, 0, 0, .35);
}
.bus-stop svg { width: 11px; height: 11px; }
.bus-stop.sm { width: 14px; height: 14px; box-shadow: none; }
.bus-stop.sm svg { width: 10px; height: 10px; }
.rts { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.leaflet-tooltip.bus-tip .rts { display: flex; margin-top: 4px; }
.rt { display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 3px; font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.bus { display: grid; gap: 6px; margin: -6px 0 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 14px; }
.bus-row { display: grid; grid-template-columns: 16px 1fr auto; gap: 8px; align-items: center; }
.bus-row small { color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.legend label.row { cursor: pointer; }
.legend label.row input { margin: 0 2px 0 0; accent-color: var(--ink); }
.legend i.lg-place { width: 14px; height: 10px; border-radius: 999px; background: var(--ink); }

/* My places */
.place-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font-size: 13px; }
.pchip button { border: 0; background: none; padding: 3px 3px 3px 10px; font-weight: 600; }
.pchip .pc-x { padding: 3px 9px 3px 5px; color: var(--ink-2); font-weight: 400; }
.pchip.on { background: var(--badger); border-color: var(--badger); }
.pchip.on button { color: #fff; }
.place-form { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); }
.pf-row { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; }
.pf-row input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
.btn.small { padding: 5px 12px; font-size: 13px; }
.place-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 240px; overflow-y: auto; }
.place-results:empty { display: none; }
.place-results button { width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: var(--radius-s); display: grid; }
.place-results button:hover, .place-results button:focus-visible { background: var(--lake-wash); }
.place-results span { font-size: 12px; color: var(--ink-2); }
.place-msg { margin: 0; font-size: 13px; color: var(--ink-2); }
.place-pin {
  position: absolute; left: 0; top: 0; transform: translate(-50%, calc(-100% - 7px));
  background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; line-height: 1;
  padding: 5px 9px; border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}
.place-pin::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink); border-bottom: 0;
}
.place-pin.ref { background: var(--badger); color: #fff; }
.place-pin.ref::after { border-top-color: var(--badger); }
.place-pin.preview { background: var(--lake); color: var(--on-accent); }
.place-pin.preview::after { border-top-color: var(--lake); }
.dist-tag {
  display: inline-block; transform: translate(-50%, -50%); background: var(--card); color: var(--ink);
  border: 1.5px solid var(--ink); font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 17px;
  border-radius: 999px; white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.pdist { list-style: none; margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 3px; }
.pdist li { display: flex; justify-content: space-between; gap: 4px 12px; flex-wrap: wrap; }
.pdist span { color: var(--ink-2); }
.res .sub .pd { color: var(--lake-ink); }
.pick-hint { display: flex; align-items: center; gap: 10px; }
.pick-hint button { border: 0; background: none; color: inherit; text-decoration: underline; padding: 0; font: inherit; }
/* Picking a spot: every click goes to the map, not to icons on it */
.leaflet-container.picking { cursor: crosshair; }
.leaflet-container.picking .leaflet-marker-icon { pointer-events: none !important; }

/* Range sliders: shared track, colored between the thumbs */
.dual { position: relative; height: 24px; }
.dual-track { position: absolute; left: 9px; right: 9px; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--line); }
.dual-fill { position: absolute; top: 0; bottom: 0; left: 0; right: 0; border-radius: 2px; background: var(--lake); }
.dual input[type=range] {
  position: absolute; left: 0; top: 0; width: 100%; height: 24px; margin: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.dual input[type=range]::-webkit-slider-runnable-track { background: none; height: 24px; }
.dual input[type=range]::-moz-range-track { background: none; }
.dual input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 18px; height: 18px; margin-top: 3px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--lake); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: grab;
}
.dual input[type=range]::-moz-range-thumb {
  pointer-events: auto; width: 14px; height: 14px; border-radius: 50%;
  background: var(--card); border: 2px solid var(--lake); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: grab;
}
.dual input[type=range]:focus-visible { outline: none; }
.dual input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--lake); outline-offset: 2px; }
.dual input[type=range]:focus-visible::-moz-range-thumb { outline: 2px solid var(--lake); outline-offset: 2px; }


/* Floor plan drawings */
.fp-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 12px 10px; }
.fp-thumb {
  flex: none; display: grid; gap: 4px; width: 132px; padding: 0; overflow: hidden; text-align: left; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff;
}
.fp-thumb img { display: block; width: 100%; height: 96px; object-fit: contain; background: #fff; }
.fp-thumb span { padding: 0 8px 6px; font-size: 12px; font-weight: 600; color: #1D2430; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-thumb:hover, .fp-thumb:focus-visible { border-color: var(--lake); }
.fp-link { border: 0; background: none; padding: 0; margin-left: 8px; font-size: 12px; color: var(--lake-ink); text-decoration: underline; text-underline-offset: 2px; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 24px; background: rgba(10, 14, 20, .82); }
.lightbox figure { margin: 0; max-width: min(1000px, 100%); display: grid; gap: 10px; justify-items: center; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; background: #fff; border-radius: var(--radius-s); }
.lightbox figcaption { color: #fff; font-size: 14px; text-align: center; }
.lb-close { position: absolute; top: 14px; right: 16px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; font-size: 24px; line-height: 1; }

/* All rentals: filters on the left, photo cards on the right, no map */
#view-grid { position: relative; }
.grail { width: var(--rail); flex: none; overflow-y: auto; border-right: 1px solid var(--line); background: var(--card); }
.gwrap { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 24px 48px; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.grid > li.empty { grid-column: 1 / -1; padding: 24px 0; }
.card {
  display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden;
}
.card:hover { border-color: var(--lake); }
.card:focus-visible { outline: 2px solid var(--lake); outline-offset: 2px; }
.cimg { aspect-ratio: 4 / 3; background: var(--paper); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.cimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cimg.fp img { object-fit: contain; background: #fff; padding: 8px; }
/* No photo: a gray map of the spot, the property as a small dot */
.cimg { position: relative; }
.spot { position: absolute; inset: 0; overflow: hidden; }
.spot-tiles { position: absolute; left: 50%; top: 50%; width: 768px; height: 768px; }
.cimg .spot-tiles img { position: absolute; width: 256px; height: 256px; max-width: none; object-fit: fill; }
.spot-dot { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2.5px var(--card), 0 1px 4px rgba(0, 0, 0, .3); }
.spot-attr { position: absolute; right: 6px; bottom: 4px; font-size: 10px; color: var(--ink-2); opacity: .8; }
.cbody { padding: 10px 12px 12px; display: grid; gap: 6px; align-content: start; }
.cbody > * { grid-column: 1 / -1; }
.ctop { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; }
.card h3 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .price { text-align: right; font-weight: 700; font-size: 15px; white-space: nowrap; }
.card .price small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-2); }
.card .price.none { font-weight: 500; font-size: 13px; color: var(--ink-2); }
.card .sub { font-size: 13px; color: var(--ink-2); }
.card .sub > span { display: block; }
.card .sub .pd { color: var(--lake-ink); }
.gmore { display: block; margin: 22px auto 0; }

/* Property page */
.gpage { flex: 1; min-width: 0; overflow-y: auto; background: var(--paper); }
body.page-open .grail, body.page-open .gwrap { display: none; }
.gp-bar { position: sticky; top: 0; z-index: 500; background: var(--paper); padding: 10px 24px; border-bottom: 1px solid var(--line); }
.back { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 14px; font-weight: 600; font-size: 14px; }
.gp { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; max-width: 1180px; margin: 0 auto; padding: 20px 24px 64px; align-items: start; }
.gp-main h2 { font-size: 28px; line-height: 1.15; margin: 0 0 6px; font-weight: 700; letter-spacing: -.01em; }
.gp-main h4 { font-size: 15px; margin: 22px 0 8px; }
.gp .addr { color: var(--ink-2); margin: 0 0 12px; }
.gp .photos { margin: 0 0 14px; padding: 0; }
.gp .photos img { height: 180px; }
.gp-side { position: sticky; top: 64px; display: grid; gap: 12px; }
.gp-map { height: 260px; border-radius: var(--radius-l); border: 1px solid var(--line); overflow: hidden; background: var(--paper); }
.gp-side .contact, .gp-side .walk, .gp-side .bus { margin: 0; }
.gp-side .contact { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px; }
body:not(.v-map) .viewswitch { display: none; }

@media (max-width: 860px) {
  #view-grid.active { flex-direction: column; overflow-y: auto; }
  .grail { width: 100%; border-right: 0; overflow: visible; flex: none; }
  .gwrap { overflow: visible; padding: 12px 12px 48px; flex: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
  .gpage { overflow: visible; flex: none; }
  .gp-bar { padding: 8px 12px; }
  .gp { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 14px 12px 56px; }
  .gp-main h2 { font-size: 24px; }
  .gp-side { position: static; }
  .gp-map { height: 220px; }
}
