/* Find Home Georgia.
 *
 * The brand kit's palette, a meaning per colour: terracotta ("Черепица") is what
 * can be pressed and the mark, green a price that fell, yellow what is new, and
 * nothing else is coloured, on warm lime-wash ("Известь") and Tbilisi night.
 * Unbounded for the mark and the prices, Fira Sans for text and its condensed
 * cut for headings; FiraGO, the same family with Georgian, is what to self-host
 * when the Georgian text matters.
 */

/* Unbounded, served from here (SIL OFL, fonts/OFL-Unbounded.txt), variable 500-700:
   the mark and the prices only -- too wide for running text. */
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(fonts/unbounded-cyrillic-var.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(fonts/unbounded-latin-var.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Fira Sans, served from here (SIL OFL, fonts/OFL.txt): Latin and Cyrillic. */
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-400.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fonts/fira-sans-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-500.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/fira-sans-latin-500.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-cyrillic-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fira Sans Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-condensed-cyrillic-600.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url(fonts/fira-sans-condensed-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* What the iPhone's home indicator takes off the bottom of the screen. */
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
  --ground: #f5f2eb;
  --surface: #ffffff;
  --sunk: #ece7dc;
  --ink: #1b2220;
  --muted: #5c6b66;
  --line: #ddd6c8;
  --line-soft: #ece7dc;
  /* Terracotta deepened to read as text (4.9:1 on the ground); the kit's own
     #d9542b is --brand, for the mark, the pins and the bars. */
  --accent: #b8421e;
  --accent-ink: #943515;
  --accent-soft: #f9e4da;
  --on-accent: #ffffff;
  --brand: #d9542b;
  --drop: #1f7a4d;
  --drop-text: #1f7a4d;
  --new: #f2c14e;
  --new-ink: #1b2220;
  --deal: #fbe7be;
  --deal-ink: #7a4700;
  --bad: #b3261e;
  --warn: #8a5a00;
  --ok: #1f7a4d;
  --radius: 12px;
  --shadow-pop: 0 14px 36px rgba(30, 38, 36, 0.18);
  --font: "Fira Sans", "FiraGO", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Fira Sans Condensed", "Fira Sans", system-ui, sans-serif;
  --font-brand: "Unbounded", "Fira Sans Condensed", system-ui, sans-serif;
  /* The lines of a chart with sizes, 1 to 4+ rooms: the one place hues mean
     nothing but "which". In this order adjacent ones stay apart for colour-blind
     eyes too (checked, light on white, dark on night); 1 and 4+ never meet. */
  --viz1: #2a78d6;
  --viz2: #eb6834;
  --viz3: #1baf7a;
  --viz4: #eda100;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ground: #141a18;
    --surface: #1b2220;
    --sunk: #232c29;
    --ink: #f5f2eb;
    --muted: #a9b5b0;
    --line: #3a4642;
    --line-soft: #26302d;
    --accent: #e8774f;
    --accent-ink: #f29a78;
    --accent-soft: #3a2419;
    --on-accent: #1b2220;
    --brand: #e8774f;
    --drop-text: #6fcf97;
    --deal: #4a3712;
    --deal-ink: #f4cf83;
    --bad: #f08a80;
    --warn: #e8b85a;
    --ok: #6fcf97;
    --viz1: #3987e5;
    --viz2: #d95926;
    --viz3: #199e70;
    --viz4: #c98500;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { text-wrap: balance; }
h1 { font: 600 30px/1.15 var(--font-num); margin: 18px 0 16px; }
h2 { font: 600 22px/1.2 var(--font-num); margin: 24px 0 8px; }
h3 { font-size: 1rem; margin: 12px 0 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--surface); padding: 10px 14px; border-radius: 10px;
}
.skip:focus { top: 12px; }

.i {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.i-s { width: 16px; height: 16px; }

.muted, .meta, .count { color: var(--muted); }
.meta { font-size: 0.87rem; margin: 6px 0; }
.count { font-size: 0.9rem; margin: 6px 0; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

main { max-width: 1280px; margin: 0 auto; padding: 8px 24px 64px; }

/* --- controls --------------------------------------------------------------- */

input, select, textarea, button { font: inherit; color: inherit; }

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  min-height: 44px; width: 100%; min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
textarea { padding: 10px 12px; min-height: 90px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }

.btn, button.btn, a.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--ink); text-decoration: none; }
.btn-primary, button.btn-primary, a.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--on-accent); }
.btn-line { border-color: var(--accent); color: var(--accent); }
.btn-line:hover { color: var(--accent-ink); border-color: var(--accent-ink); }
.btn-big { min-height: 52px; font-size: 1.05rem; }
.btn-block { width: 100%; white-space: normal; text-align: center; padding-top: 8px; padding-bottom: 8px; }

/* Plain <button> on the admin pages. */
button:not([class]) {
  min-height: 40px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 500;
}
button.secondary { min-height: 40px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); }

.linkish {
  background: none; border: 0; padding: 0; min-height: 44px;
  color: var(--accent); font-weight: 500; cursor: pointer;
}

.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--sunk); border-radius: 10px;
}
.seg a, .seg button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 500;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.seg a:hover { color: var(--ink); text-decoration: none; }
.seg .on, .seg [aria-current] {
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line);
}

/* --- header ----------------------------------------------------------------- */

.hdr { background: var(--surface); border-bottom: 1px solid var(--line); }
.hdr-in {
  max-width: 1280px; margin: 0 auto; padding: 10px 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); font-family: var(--font-brand); white-space: nowrap;
}
.brand:hover { color: var(--ink); text-decoration: none; }
.brand .mark { width: 34px; height: 34px; flex: none; }
.brand .mark .roof { stroke: var(--brand); }
/* The older lockup, an icon and one line, as the Mini App's entry page has it. */
.brand > .i { width: 26px; height: 26px; color: var(--brand); }
.brand > span:not(.name) { font-weight: 700; font-size: 17px; }
.brand .name { display: flex; flex-direction: column; gap: 3px; }
.brand .name b { font-weight: 700; font-size: 17px; line-height: 1; letter-spacing: -0.2px; }
.brand .name small { font-weight: 500; font-size: 8.5px; line-height: 1; letter-spacing: 3.4px;
  text-transform: uppercase; color: var(--muted); }
.city { width: auto; }
.city-form { margin: 0; }
.city-form select { width: auto; }

.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  color: var(--muted); font-weight: 500;
}
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.pill-n {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--sunk); color: var(--ink); font-size: 0.75rem; text-align: center;
  font-variant-numeric: tabular-nums;
}

.modes { display: flex; gap: 10px; }

/* The account's menu and the city's: a button, and a list under it. */
.account, .menu { position: relative; }
.account > summary, .menu > summary {
  list-style: none; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 12px; border-radius: 10px; cursor: pointer;
  font-weight: 500; white-space: nowrap;
}
.account > summary { width: 44px; padding: 0; justify-content: center; border: 1px solid var(--line); }
.menu > summary { gap: 6px; background: var(--sunk); }
.account > summary::-webkit-details-marker,
.menu > summary::-webkit-details-marker { display: none; }
.city-pick > summary > .i:first-child { color: var(--brand); }
.account-menu, .menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-pop); padding: 6px; display: flex; flex-direction: column;
}
.menu-list { left: 0; right: auto; min-width: 200px; }
.account-menu a, .account-menu button, .menu-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding: 0 12px; border-radius: 8px; border: 0; background: none;
  color: var(--ink); text-align: left; cursor: pointer; width: 100%;
}
.account-menu a:hover, .account-menu button:hover, .menu-list a:hover {
  background: var(--ground); text-decoration: none;
}
.menu-list a[aria-current] { background: var(--ground); font-weight: 600; }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }
.account-menu .who {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 12px; color: var(--muted); font-size: 0.87rem;
}
.account-menu .who b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
/* A name of any length: the menu stays on the screen, the name wraps. */
.account-menu { max-width: min(320px, calc(100vw - 32px)); }
.account-menu form { margin: 0; }

.seg-lang a { padding: 0 10px; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.04em; }

.preview-bar {
  background: var(--deal); color: var(--deal-ink);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px;
  padding: 6px 16px; font-size: 0.92rem;
}
.preview-bar form { margin: 0; }
.preview-bar button { min-height: 36px; background: none; border: 0; color: inherit;
  text-decoration: underline; cursor: pointer; font-weight: 500; }

/* The phone's tab bar: the four places, under the thumb. */
.tabbar { display: none; }

/* One row however wide the screen: the name beside the mark gives way
   first; under 1200 px, a tablet's, the sections go to the tab bar. */
@media (max-width: 1279px) {
  .hdr-in { gap: 10px 12px; }
  .brand .name { display: none; }
}

@media (max-width: 1199px) {
  .nav, .hdr .login-btn { display: none; }
  .seg-lang { margin-left: auto; }
  main { padding-bottom: 96px; }
  .site-foot { padding-bottom: 96px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: var(--safe-bottom);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; min-height: 60px; font-size: 0.75rem; font-weight: 500; color: var(--muted);
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .i { width: 24px; height: 24px; }
}

@media (max-width: 760px) {
  /* Two rows, edge to edge in either language: the mark, the city, the
     language and the account; under them what is looked for, in halves. */
  .hdr-in {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas: "brand city . lang me" "modes modes modes modes modes";
    align-items: center; padding: 8px 16px; gap: 8px;
  }
  .brand { grid-area: brand; }
  .brand .mark { width: 30px; height: 30px; }
  .city-pick { grid-area: city; }
  .seg-lang { grid-area: lang; margin-left: 0; }
  .hdr .account { grid-area: me; }
  .modes {
    grid-area: modes; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .modes .seg { display: flex; }
  .modes .seg a { flex: 1; justify-content: center; }
  .views span { display: none; }
  .feed-head h1 { font-size: 24px; }
  main { padding: 4px 16px 96px; }
}

.site-foot {
  max-width: 1280px; margin: 0 auto; padding: 24px 24px 32px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line);
}
.site-foot .langs { display: flex; gap: 14px; margin-left: auto; }
.site-foot .langs a[aria-current] { color: var(--ink); font-weight: 500; }

/* --- the filter bar ------------------------------------------------------------- */

.toolbar {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; padding: 14px 0 6px;
}
.fgroups, .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tools select { width: auto; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.pill:hover { border-color: var(--muted); }
.pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.pill .i-s { transition: transform 0.15s; }
.pill[aria-expanded="true"] .chev { transform: rotate(180deg); }
.badge-n {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 0.78rem;
}

.fgroup { position: relative; }

/* Without JavaScript every panel is simply open, one under another, and the
   form still filters; with it they become drop-downs. */
.fpanel {
  display: flex; flex-direction: column; gap: 14px;
  margin-top: 8px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.js .fpanel {
  display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 25;
  width: 340px; max-height: 70vh; overflow-y: auto; overscroll-behavior: contain;
  margin: 0; box-shadow: var(--shadow-pop);
}
.js .fpanel.wide { width: 560px; }
.js .fgroup.open > .fpanel { display: flex; }
/* A long panel scrolls, its "Show" button stays in reach. */
.js .fpanel .fpanel-foot {
  position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 12px 16px 16px;
  background: var(--surface); border-top: 1px solid var(--line-soft);
}
.fpanel-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding-top: 4px;
}
.fgrp { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fgrp legend, .fgrp > .flabel { font-weight: 500; padding: 0; margin-bottom: 2px; }
.pair-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pair-inputs label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.fcols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.fcols .full { grid-column: 1 / -1; }

.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.tg { position: relative; }
.tg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tg span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 52px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-weight: 500; cursor: pointer;
}
.tg input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.tg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.checks { display: flex; flex-direction: column; gap: 2px; }
.check {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px;
  border-radius: 8px; cursor: pointer;
}
.check:hover { background: var(--ground); }
.check small { color: var(--muted); margin-left: auto; }
.district-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.district-list h4 { margin: 10px 6px 2px; font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.district-search { margin-bottom: 4px; }

.sheet-head, .sheet-foot, .only-phone { display: none; }
.sheet-body { display: contents; }

@media (max-width: 760px) {
  .toolbar { padding-top: 10px; }
  .js .fgroups {
    display: none; position: fixed; inset: 56px 0 0; z-index: 60;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0;
    background: var(--surface); border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 30px rgba(30, 38, 36, 0.25);
  }
  .js .fgroups.sheet-open { display: flex; }
  .js .sheet-body { display: block; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 16px; }
  .js .sheet-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 8px 6px 20px;
  }
  .js .sheet-head h2 { margin: 0; }
  .js .sheet-foot {
    display: flex; gap: 12px; align-items: center;
    padding: 12px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
  }
  .js .sheet-foot .btn-primary { flex: 1; }
  .js .fgroup > .pill { display: none; }
  .js .fgroup { padding: 16px 0; border-top: 1px solid var(--line-soft); }
  .js .fgroup:first-child { border-top: 0; padding-top: 4px; }
  .js .fgrp legend, .js .fgrp > .flabel, .js .fpanel > .flabel { font: 600 18px/1.2 var(--font-num); margin-bottom: 6px; }
  .js .fgroup > .fpanel {
    display: flex; position: static; width: auto; max-height: none; overflow: visible;
    padding: 0; border: 0; box-shadow: none;
  }
  .js .fpanel-foot { display: none; }
  .js .fcols { grid-template-columns: 1fr; }
  .js .only-phone { display: inline-flex; }
  .sheet-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(20, 26, 24, 0.45); }
  .toolbar { flex-wrap: nowrap; }
  .tools { flex: 1; min-width: 0; flex-wrap: nowrap; }
  .tools select { flex: 1; min-width: 0; }
  .hdr .seg a { padding: 0 8px; font-size: 14px; }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 6px 0 12px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.9rem;
}
.chip:hover { text-decoration: none; color: var(--accent-ink); filter: brightness(0.97); }
.chip .i { width: 16px; height: 16px; }
.chips .reset { align-self: center; padding: 0 8px; font-size: 0.9rem; }

/* --- feed heading and paging ---------------------------------------------------- */

.feed-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 16px; margin: 14px 0 18px;
}
.feed-head h1 { margin: 0; }
.feed-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.feed-tools form { margin: 0; }
.feed-head .count { margin: 0; }
.tab-title { margin: 16px 0 6px; }
.caveat { color: var(--muted); max-width: 70ch; margin: 0 0 14px; }
.empty { color: var(--muted); padding: 36px 0; text-align: center; }

.pager {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px;
  padding: 32px 0 8px;
}
.pager a, .pager span {
  display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 10px;
  border-radius: 10px; color: var(--ink); font-variant-numeric: tabular-nums;
}
.pager a:hover { background: var(--surface); text-decoration: none; }
.pager [aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.pager .gap { color: var(--muted); }

/* --- A: cards ------------------------------------------------------------------- */

.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 36px 24px;
}
.card { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card.is-hidden-row { opacity: 0.5; }
.card.delisted .thumb img { filter: grayscale(1); }
.card .body { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.card .cover { color: var(--ink); display: flex; flex-direction: column; gap: 5px; }
.card .cover:hover { text-decoration: none; color: var(--ink); }

.thumb {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--radius); background: var(--line); margin-bottom: 4px;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-photo { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

.price-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.price {
  font: 700 23px/1.15 var(--font-brand); letter-spacing: -0.3px; color: var(--ink);
}
.price small { font: 400 15px var(--font); color: var(--muted); }
.ppm2 { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.drop {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 6px; border-radius: 999px;
  background: var(--drop); color: #fff;
  font-size: 0.9rem; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rise { color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.facts { display: flex; flex-wrap: wrap; gap: 2px 14px; }
.where { color: var(--muted); font-size: 0.92rem; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.terms { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.term {
  border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px;
  font-size: 0.85rem; color: var(--ink);
}
.term.no { color: var(--muted); text-decoration: line-through; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.foot .meta { margin: 0; }
.last-seen { color: var(--muted); font-size: 0.87rem; margin: 0; }
.tr-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; vertical-align: 1px;
}

/* Save and hide sit on the photo, out of the link. */
.card-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; z-index: 2; }
.icon-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.94); color: #1b2220;
}
/* Hover only where there is one: a phone keeps :hover after a tap, and a heart
   just taken back stayed orange as if still saved. */
@media (hover: hover) {
  .icon-btn:hover { color: var(--accent); }
  .icon-btn.plain:hover { background: var(--ground); }
}
.icon-btn.on { color: var(--accent); }
.icon-btn.on .i { fill: currentColor; }
.icon-btn.plain { background: transparent; color: var(--muted); }
/* Saved: the brand's orange, filled, unmistakable at a glance; a second press
   takes it back. */
.icon-btn.fav.on, .icon-btn.fav.on:hover { background: var(--brand); color: #fff; }
.icon-btn.plain.fav.on, .icon-btn.plain.fav.on:hover { background: transparent; color: var(--brand); }
.btn.fav.on, .btn.fav.on:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.fav.on .i { fill: currentColor; }
.badge {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  background: var(--surface); color: var(--ink);
  font-size: 0.8rem; font-weight: 500; padding: 2px 8px; border-radius: 6px;
}
.badge.gone { background: var(--ink); color: var(--surface); }
.badge.new { background: var(--new); color: var(--new-ink); font-weight: 700; }
/* Photographs that are also another flat's: below, so it never hides "new". */
.badge.doubt { top: auto; bottom: 12px; background: var(--warn); color: var(--surface); }
.doubt-note { color: var(--warn); margin: 4px 0 8px; }

/* --- photo carousel (a card's, and the listing page's) ------------------------- */

.carousel { position: relative; }
.carousel-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: none; height: 100%;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.slide { flex: 0 0 100%; scroll-snap-align: center; margin: 0; display: flex; align-items: center; justify-content: center; }
.slide a { display: block; width: 100%; height: 100%; }
.carousel.compact .slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 36px; height: 44px; padding: 0; border: 0; border-radius: 8px;
  background: rgba(20, 26, 24, 0.55); color: #fff; font-size: 1.4rem; line-height: 1;
  cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
.carousel-nav.prev { left: 8px; }
.carousel-nav.next { right: 8px; }
.card:hover .carousel-nav, .carousel-nav:focus-visible { opacity: 0.9; }
.lightbox .carousel-nav { opacity: 0.85; width: 48px; height: 64px; font-size: 2rem; }
@media (hover: none) { .carousel-nav { opacity: 0.75; } }
.carousel-count {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(20, 26, 24, 0.7); color: #fff; font-size: 0.78rem;
  padding: 1px 8px; border-radius: 999px; font-variant-numeric: tabular-nums;
}
.carousel-dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.carousel-dots .dot { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 0; background: var(--line); cursor: pointer; }
.carousel-dots .dot.on { background: var(--accent); }

/* --- B: a list beside the map ---------------------------------------------------- */

.split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.split-list {
  flex: 1 1 520px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.split-map { flex: 1 1 520px; min-width: 0; position: sticky; top: 12px; }
.split-map .map-canvas { height: calc(100vh - 40px); min-height: 480px; }
.row { position: relative; border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: 0; }
.row .cover {
  display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px;
  padding: 14px 60px 14px 14px; color: var(--ink);
}
.row .cover:hover { text-decoration: none; background: var(--ground); color: var(--ink); }
.row.on { box-shadow: inset 3px 0 0 var(--accent); background: var(--accent-soft); }
.row .thumb { margin: 0; border-radius: 10px; }
.row .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row .price { font-size: 23px; }
.row .card-actions { top: 12px; right: 8px; }
.split-list .pager { padding: 16px 0; }
@media (max-width: 760px) {
  .split-map { position: static; order: -1; flex-basis: 100%; }
  .split-map .map-canvas { height: 60vh; min-height: 320px; }
  .row .cover { grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding-right: 52px; }
  .row .price { font-size: 20px; }
}

/* --- C: a table ----------------------------------------------------------------- */

.table-box {
  position: relative; overflow-x: auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px;
}
table.listings { border-collapse: collapse; width: 100%; min-width: 1000px; }
table.listings th {
  font-weight: 500; color: var(--muted); font-size: 0.9rem; text-align: left;
  padding: 0 12px; height: 48px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.listings th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }
table.listings th[aria-sort] a { color: var(--ink); font-weight: 600; }
table.listings td {
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
table.listings tbody tr:last-child td { border-bottom: 0; }
table.listings tbody tr:hover td { background: var(--ground); }
table.listings .n { text-align: right; }
table.listings .t-thumb { width: 100px; }
table.listings .t-thumb a { display: block; width: 84px; height: 63px; border-radius: 8px; overflow: hidden; background: var(--line); }
table.listings .t-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
table.listings .price { font-size: 20px; white-space: nowrap; }
table.listings .t-place { max-width: 300px; }
table.listings .t-place span { display: block; color: var(--muted); font-size: 0.9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
table.listings .t-src { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }

/* --- teasers: what a tier without access sees ---------------------------------- */

.gate { position: relative; border-radius: 16px; overflow: hidden; }
.gate-blur { filter: blur(7px) saturate(0.8); pointer-events: none; user-select: none; }
.gate-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  width: min(440px, calc(100% - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-pop); padding: 22px; text-align: center;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.gate-card h2 { margin: 0; }
.gate-card p { margin: 0; color: var(--muted); }
.gate-card .btn { margin-top: 6px; }
.gate { min-height: 380px; }
.gate.top .gate-card { top: 48px; transform: translateX(-50%); }
.skeleton .ph { background: var(--line); border-radius: var(--radius); aspect-ratio: 4 / 3; }
.skeleton .ln { height: 14px; border-radius: 6px; background: var(--line); }
.skeleton .ln.big { height: 24px; width: 55%; background: var(--muted); opacity: 0.4; }
.skeleton .ln.w70 { width: 70%; }
.skeleton .ln.w40 { width: 40%; }
.gate-inline {
  display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink);
}

/* --- a listing's own page --------------------------------------------------------- */

.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 500; }
.gallery { position: relative; margin: 4px 0 28px; }
.gallery .carousel-count { display: none; }
.mosaic {
  display: grid; gap: 8px;
  grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 220px 220px;
  border-radius: 16px; overflow: hidden;
}
.mosaic a { display: block; background: var(--line); overflow: hidden; }
.mosaic a.extra { display: none; }
.mosaic a:first-child { grid-row: span 2; }
.mosaic.n1 { grid-template-columns: 1fr; grid-template-rows: 440px; }
.mosaic.n1 a:first-child, .mosaic.n2 a:first-child { grid-row: auto; }
.mosaic.n2 { grid-template-columns: 2fr 1fr; grid-template-rows: 440px; }
.mosaic.n3, .mosaic.n4 { grid-template-columns: 2fr 1fr; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mosaic a:hover img { filter: brightness(0.92); }
.gallery .all {
  position: absolute; right: 14px; bottom: 14px;
  box-shadow: 0 2px 8px rgba(20, 26, 24, 0.25);
}
.lightbox {
  width: min(1200px, 100vw); max-width: 100vw; height: min(92vh, 900px); max-height: 100vh;
  padding: 0; border: 0; border-radius: 16px; background: #0f1312; color: #fff;
  overscroll-behavior: contain;
}
.lightbox::backdrop { background: rgba(10, 14, 13, 0.85); }
.lightbox .carousel, .lightbox .carousel-track { height: 100%; }
.lightbox .slide img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; margin: auto; }
.lightbox .close { position: absolute; top: 10px; right: 10px; z-index: 3; }

.cols { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.cols .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 36px; }
.aside {
  flex: 1 1 340px; max-width: 400px; min-width: 0; position: sticky; top: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; display: flex; flex-direction: column; gap: 12px;
}
.price-bar {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between;
  gap: 12px 20px; margin: 0 0 24px;
}
.price-bar .price { font-size: 42px; line-height: 1; }
.price-bar .price-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.price-bar .drop { align-self: center; }
/* Against the fortnight's median of its like (web/market.py): below is good news. */
.vs-market {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600; white-space: nowrap;
}
.vs-market.below { background: #e3f4e8; color: #1d6b38; }
.vs-market.above { background: #fbf0c8; color: #7a5a00; }
.vs-market-note { color: var(--muted); font-size: 0.85rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .vs-market.below { background: #1d3527; color: #8fd6a6; }
  :root:not([data-theme="light"]) .vs-market.above { background: #3a3017; color: #e8c766; }
}
:root[data-theme="dark"] .vs-market.below { background: #1d3527; color: #8fd6a6; }
:root[data-theme="dark"] .vs-market.above { background: #3a3017; color: #e8c766; }
.price-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 520px; }
.price-actions .note { flex-basis: 100%; margin: 0; text-align: right; color: var(--muted); font-size: 0.9rem; }
.aside hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.aside .note { color: var(--muted); font-size: 0.9rem; margin: 0; }
.prop-title { margin: 0 0 6px; font-size: 36px; }
.loc { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 1rem; }
.approx { font-style: italic; }
dl.facts-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px;
  margin: 20px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line);
}
dl.facts-grid div { display: flex; flex-direction: column; }
dl.facts-grid dt { color: var(--muted); font-size: 0.9rem; }
dl.facts-grid dd { margin: 0; font-size: 1.06rem; font-weight: 500; }
.unsure-note { color: var(--muted); font-size: 0.85rem; margin: 10px 0 0; }
.lead { color: var(--muted); margin: 0 0 14px; max-width: 66ch; }
.amenities { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.amenities li::before { content: "✓ "; color: var(--accent); }

.chart { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 10px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { font: 12px var(--font); fill: var(--muted); }
.chart .ax-e { text-anchor: end; }
.chart .ax-m { text-anchor: middle; }
.chart .gl { stroke: var(--line-soft); stroke-width: 1; }
.chart .ln { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.chart .s0 { stroke: var(--accent); }
.chart .s1 { stroke: var(--ink); stroke-dasharray: 6 4; }
.chart .s2 { stroke: var(--muted); stroke-dasharray: 2 4; }
.chart .d0 { fill: var(--accent); }
.chart .d1 { fill: var(--surface); stroke: var(--ink); stroke-width: 1.8; }
.chart .d2 { fill: var(--surface); stroke: var(--muted); stroke-width: 1.8; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.9rem; color: var(--muted); padding: 6px 4px 0; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }
.legend .k0 { border-color: var(--accent); }
.legend .k1 { border-color: var(--ink); border-top-style: dashed; }
.legend .k2 { border-color: var(--muted); border-top-style: dotted; }
details.all-obs { margin-top: 10px; }
details.all-obs summary { cursor: pointer; color: var(--accent); min-height: 44px; display: flex; align-items: center; }

.posts { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.post {
  display: grid; grid-template-columns: 110px minmax(0, 1fr) 160px auto; gap: 12px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line-soft); min-height: 60px;
}
.post:last-child { border-bottom: 0; }
.post.own { background: var(--accent-soft); }
.post.delisted { color: var(--muted); }
.post .who { display: flex; flex-direction: column; min-width: 0; }
.post .who b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post .who span { color: var(--muted); font-size: 0.9rem; }
.post .who .tag { color: #fff; }
.post .state { font-size: 0.9rem; color: var(--muted); }
.post .state.live { color: var(--ink); }
.post a.open { justify-self: end; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 500; }
.tag {
  display: inline-flex; align-self: flex-start; padding: 0 8px; border-radius: 6px;
  background: var(--accent); color: var(--on-accent); font-size: 0.82rem; font-weight: 500;
}
.posts details > summary { list-style: none; cursor: pointer; text-align: center; color: var(--accent); font-weight: 500; min-height: 48px; display: grid; place-items: center; border-top: 1px solid var(--line-soft); }
.posts details > summary::-webkit-details-marker { display: none; }
.posts details[open] > summary { display: none; }
@media (max-width: 760px) {
  .post { grid-template-columns: minmax(0, 1fr) auto; }
  .post .site { grid-column: 1 / -1; font-weight: 600; }
  .post .state { grid-column: 1; }
}
.desc p { margin: 0 0 10px; max-width: 68ch; font-size: 1.02rem; }
details.original { margin: 6px 0 0; }
details.original > summary { cursor: pointer; color: var(--accent); min-height: 40px; display: inline-flex; align-items: center; }
.mini-map { height: 200px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--sunk); }
.note-form { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; max-width: 640px; }

@media (max-width: 760px) {
  /* Every photo in a strip, swiped one at a time. */
  .gallery { margin: 0 -16px 20px; }
  .mosaic, .mosaic.n1, .mosaic.n2, .mosaic.n3, .mosaic.n4 {
    display: flex; gap: 0; height: 300px; border-radius: 0;
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .mosaic::-webkit-scrollbar { display: none; }
  .mosaic a, .mosaic a.extra {
    display: block; flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always;
  }
  .gallery .all { display: none; }
  .gallery .carousel-count { display: block; }
  .prop-title { font-size: 26px; }
  .price-bar { margin-bottom: 16px; }
  .price-bar .price { font-size: 32px; }
  /* Icons alone beside the price; the words stay for a screen reader. */
  .price-actions .btn { padding: 0 12px; }
  /* The bar at the bottom of the screen opens it there. */
  .price-actions .open-original, .price-actions .note { display: none; }
  .price-actions [data-label] {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .aside { position: static; max-width: none; }
  .has-buybar main { padding-bottom: calc(170px + var(--safe-bottom)); }
  .chart .ax { font-size: 22px; }
  .cols { gap: 24px; }
  /* On the tab bar, which is as tall as the iPhone's home indicator makes it. */
  .buybar {
    position: fixed; left: 0; right: 0; bottom: calc(61px + var(--safe-bottom)); z-index: 25;
    display: flex; gap: 10px; padding: 10px 16px;
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .buybar .btn-primary { flex: 1; }
}
.buybar { display: none; }
@media (max-width: 760px) { .buybar { display: flex; } }

/* --- price dynamics ---------------------------------------------------------------- */

.prices-head { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.prices-head h1 { margin: 18px 0 14px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.summary .stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.summary .n { display: block; font: 700 22px/1.2 var(--font-brand); letter-spacing: -0.3px; }
.summary .label { color: var(--muted); font-size: 0.9rem; }
.summary .stat.down .n { color: var(--drop-text); }
.medians h2 { margin-top: 8px; }
.median-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.median-grid .stat {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
}
.median-grid .stat.all { grid-column: 1 / -1; padding: 16px 18px; }
.median-grid .label { color: var(--muted); font-size: 0.9rem; }
.median-grid .n { font: 700 22px/1.2 var(--font-brand); letter-spacing: -0.3px; }
.median-grid .all .n { font-size: 32px; }
.median-grid .meta { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.history-h { margin: 0 0 8px; font-size: 1.05rem; }
.history-h small { color: var(--muted); font-weight: 400; font-size: 0.85rem; margin-left: 6px; }
.history-wrap { overflow-x: auto; margin: 0 0 8px; }
table.median-history { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.median-history th, table.median-history td {
  padding: 8px 6px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.median-history th:first-child { text-align: left; white-space: normal; padding-left: 0; }
table.median-history thead th, table.median-history tbody th { color: var(--muted); font-weight: 500; font-size: 0.9rem; }
.spark { width: 220px; height: 32px; color: var(--accent); display: block; }
/* The medians by day (marketchart.py): all of it in ink, the sizes in --viz1-4.
   The lines stretch to the plot's box; the axes are HTML around it, the y one in
   a gutter of its own so that no line runs through a number. The crosshair, its
   dots and the readout are app.js's. */
.mchart { margin: 0 0 8px; }
.mchart .legend { padding: 0 4px 4px; }
.mchart-plot { position: relative; height: 280px; margin: 16px 4px 30px 56px; touch-action: pan-y; }
.mchart-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
/* Focus shows the crosshair on a day, which is the outline it needs. */
.mchart-plot svg:focus { outline: none; }
.mchart .gl { stroke: var(--line-soft); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.mchart .ml { fill: none; stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.mchart .ml.m0 { stroke-width: 2.5px; }
.mchart .rule { stroke: var(--muted); stroke-width: 1px; vector-effect: non-scaling-stroke; display: none; }
.mchart .ya, .mchart .xa { position: absolute; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mchart .ya { right: calc(100% + 10px); transform: translateY(-50%); }
.mchart .xa { top: calc(100% + 8px); transform: translateX(-50%); }
.mchart .xa.first { transform: none; }
.mchart .xa.last { transform: translateX(-100%); }
.mchart .dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface); display: none; pointer-events: none; }
.mchart.hover .rule, .mchart.hover .dot.on { display: block; }
.mchart .ml.m0 { stroke: var(--ink); } .mchart .dot.m0 { background: var(--ink); }
.mchart .ml.m1 { stroke: var(--viz1); } .mchart .dot.m1 { background: var(--viz1); }
.mchart .ml.m2 { stroke: var(--viz2); } .mchart .dot.m2 { background: var(--viz2); }
.mchart .ml.m3 { stroke: var(--viz3); } .mchart .dot.m3 { background: var(--viz3); }
.mchart .ml.m4 { stroke: var(--viz4); } .mchart .dot.m4 { background: var(--viz4); }
.mchart i.m0 { border-color: var(--ink); }
.mchart i.m1 { border-color: var(--viz1); }
.mchart i.m2 { border-color: var(--viz2); }
.mchart i.m3 { border-color: var(--viz3); }
.mchart i.m4 { border-color: var(--viz4); }
/* Beside the hairline (--at), on whichever side has the room. */
.mchart-tip {
  position: absolute; top: 0; left: var(--at, 0); z-index: 2; display: none; margin: 0 14px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-pop); font-size: 0.85rem; pointer-events: none;
}
.mchart-tip.flip { left: auto; right: calc(100% - var(--at, 0%)); }
.mchart.hover .mchart-tip { display: block; }
.mchart-tip .d { color: var(--muted); margin-bottom: 4px; }
.mchart-tip .r { display: flex; align-items: center; gap: 8px; white-space: nowrap; line-height: 1.5; }
.mchart-tip .r i { display: inline-block; width: 14px; height: 0; border-top-width: 2px; border-top-style: solid; }
.mchart-tip .r b { font-variant-numeric: tabular-nums; min-width: 5.5em; }
.mchart-tip .r span { color: var(--muted); }
.mchart-table summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 6px 4px 0; }
.mchart-table .history-wrap { margin-top: 8px; max-height: 360px; overflow-y: auto; }
/* A phone: the finger is on the chart, so the readout goes over the legend,
   above it, two to a row. */
@media (max-width: 760px) {
  .mchart-plot { height: 220px; margin-left: 50px; }
  .mchart .ya, .mchart .xa { font-size: 11px; }
  .mchart-tip, .mchart-tip.flip { left: -50px; right: -4px; top: auto; bottom: calc(100% + 6px); margin: 0; }
  .mchart.hover .mchart-tip { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .mchart-tip .d { grid-column: 1 / -1; }
  .mchart-tip .r b { min-width: 0; }
}
.day { margin-bottom: 24px; }
.day h2 { font-size: 1.1rem; margin: 0 0 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.day-stats { color: var(--muted); font: 400 0.9rem var(--font); }
table.changes {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
table.changes td { padding: 8px 10px; border-top: 1px solid var(--line-soft); vertical-align: middle; font-variant-numeric: tabular-nums; }
table.changes tr:first-child td { border-top: 0; }
/* A column of links: in the ink, the accent only under the pointer. */
table.changes td.what a { color: var(--ink); font-weight: 500; }
table.changes td.what a:hover { color: var(--accent); }
table.changes .thumb-cell { width: 70px; }
table.changes .thumb-cell a { display: block; width: 60px; height: 45px; border-radius: 6px; overflow: hidden; background: var(--line); }
table.changes .thumb-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
table.changes .pct { white-space: nowrap; width: 90px; }
table.changes .money { white-space: nowrap; }
table.changes .was { color: var(--muted); text-decoration: line-through; margin-right: 6px; }
table.changes .what .where { display: block; }
table.changes .marks { text-align: right; white-space: nowrap; color: var(--muted); font-size: 0.9rem; }
@media (max-width: 760px) {
  table.changes .thumb-cell, table.changes .marks { display: none; }
  table.changes .where, table.changes .money { white-space: normal; }
  .prices-head .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
}

/* --- maps --------------------------------------------------------------------------- */

.map-canvas {
  width: 100%; height: calc(100vh - 200px); min-height: 420px;
  border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--sunk);
}
.map-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 12px 0;
}
.map-count { color: var(--muted); font-size: 0.9rem; margin-left: auto; }
.map-providers { display: inline-flex; gap: 6px; }
.map-providers a {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: var(--surface);
}
.map-providers a.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.map-providers a:hover { text-decoration: none; }
.heat-n { opacity: 0.75; font-size: 0.8rem; }
.heat-rooms-label { color: var(--muted); font-size: 0.9rem; }
.heat-rooms a { padding: 0 12px; }
.heat-legend { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.heat-legend[hidden] { display: none; }
.heat-gradient { width: 140px; height: 10px; border-radius: 5px; background: linear-gradient(to right, #2e9e5b, #f2c230, #d7263d); }
.map-warn { color: var(--warn); }
.map-failed { margin: 16px; }
/* The whole-width map, and the card a point opens over it. */
.map-wrap { position: relative; }
.map-full { height: calc(100vh - 250px); min-height: 480px; }
.map-card {
  position: absolute; top: 16px; left: 16px; z-index: 4; width: 380px;
  max-height: calc(100% - 32px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-pop);
}
.map-card[hidden] { display: none; }
.map-card .mc-close { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(255, 255, 255, 0.94); color: #1b2220; }
.mc-photo { display: block; aspect-ratio: 16 / 10; background: var(--line); }
.mc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mc-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; }
.mc-body .btn { margin-top: 6px; }
.mc-head { padding: 16px 56px 10px 16px; border-bottom: 1px solid var(--line-soft); }
.mc-head h2 { margin: 0 0 2px; font-size: 20px; }
.mc-list { display: flex; flex-direction: column; }
.mc-item {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft); color: var(--ink);
}
.mc-item:hover { background: var(--ground); text-decoration: none; color: var(--ink); }
.mc-item .thumb { margin: 0; border-radius: 8px; }
.mc-item-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mc-item .price { font-size: 20px; }
@media (max-width: 760px) {
  .map-full { height: calc(100vh - 300px); min-height: 360px; }
  .map-card { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 65%; }
}
.map-under { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; }
.map-under .count { margin: 0; }
.switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
  font-weight: 500; cursor: pointer;
}
.switch:hover { text-decoration: none; color: var(--ink); border-color: var(--muted); }
.switch .track { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; flex: none; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: left 0.15s;
}
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .track::after { left: 19px; }
.map-highlight {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 3px var(--accent);
}

/* Map balloons sit on MapLibre's white popup whatever the theme. */
.balloon { display: flex; gap: 10px; max-width: 330px; font: 13px/1.4 var(--font); color: #1b2220; }
.balloon img { width: 108px; height: 82px; object-fit: cover; border-radius: 8px; flex: none; }
.bl-body { min-width: 0; }
.balloon-group, .maplibregl-popup-content { color: #1b2220; }
.bl-price { font: 700 16px/1.2 var(--font-brand); color: #1b2220; }
.bl-drop { display: inline-block; background: #1f7a4d; color: #fff; border-radius: 999px; padding: 0 6px; font: 500 12px var(--font); margin-left: 4px; }
.bl-specs { margin-top: 2px; }
.bl-where { color: #5c6b66; font-size: 12px; }
.bl-origin { color: #8a5a00; font-size: 12px; margin-top: 3px; }
.bl-open { display: inline-block; margin-top: 5px; font-weight: 500; color: #b8421e; }
.balloon-group { max-width: 360px; max-height: 60vh; overflow-y: auto; }
.bg-head { font-weight: 600; font-size: 13px; padding: 2px 0 6px; position: sticky; top: 0; background: #fff; }
.balloon-group .balloon { border-top: 1px solid #ece7dc; padding-top: 8px; margin-top: 8px; }
.balloon-group .balloon:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }

/* --- sources, kinds, misc --------------------------------------------------------- */

.src { font-size: 0.85rem; color: var(--muted); margin-right: 8px; white-space: nowrap; }
.kind { font-size: 0.85rem; color: var(--muted); }
.kind-house, .kind-country_house { color: var(--ink); font-weight: 500; }
.copied { color: var(--ok) !important; }
.copy-failed { color: var(--bad) !important; }

/* --- admin pages: status, duplicates, filters, access ------------------------------ */

.panel, .source, .candidate, .profile, .scrape-now {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 14px;
}
.source.level-bad { border-left: 4px solid var(--bad); }
.source.level-warn { border-left: 4px solid var(--warn); }
.source.level-ok { border-left: 4px solid var(--ok); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }
.alarm { padding: 8px 12px; border-radius: 10px; font-size: 0.92rem; margin: 6px 0; }
.alarm.bad { background: rgba(179, 38, 30, 0.12); color: var(--bad); }
.alarm.warn { background: var(--deal); color: var(--deal-ink); }
.alarm.ok { background: var(--accent-soft); color: var(--accent-ink); }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
td.msg { color: var(--muted); font-size: 0.85rem; }
.counters th { color: var(--muted); font-weight: 500; width: 1%; white-space: nowrap; }
.histogram { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.histogram li { background: var(--ground); border-radius: 8px; padding: 3px 10px; font-size: 0.87rem; }
.sparkline-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 2px; }
.signals { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.87rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.side { background: var(--ground); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; min-width: 0; }
.side .local { display: block; font-size: 0.85rem; margin-top: 4px; }
.side .where, .side .specs { overflow-wrap: anywhere; white-space: normal; }
.side-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.side-head .badge { position: static; }
.side-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-bottom: 8px; }
.side-photos a { display: block; }
.side-photos img { width: 100%; height: 78px; object-fit: cover; border-radius: 6px; display: block; background: var(--line); }
.side-links { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 0.87rem; min-width: 0; }
.side-links a { white-space: nowrap; }
.side-links .local { color: var(--muted); flex-basis: 100%; }
.side-links .delisted-link { color: var(--muted); text-decoration: line-through; }
.candidate-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.candidate-head h2 { margin: 0; }
.no-photo-line { font-style: italic; }
.scrape-now { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.scrape-now form { margin: 0; }
.scrape-now .meta { margin: 0; flex: 1; min-width: 220px; }
.scrape-lines { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 0.87rem; color: var(--muted); }
.scrape-lines li { padding: 2px 0; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.filter-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.87rem; color: var(--muted); }
.settings-grid label { text-transform: capitalize; }
form.inline { display: inline-block; margin-top: 8px; }
.access-table select { min-width: 150px; }
.access-table td, .access-table th { padding: 10px 12px; vertical-align: middle; }
.access-table th[scope="row"] { font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.row-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.row-form select { width: auto; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.plans .plan { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.plans .plan.mine { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plans ul { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-direction: column; gap: 6px; }
.plans li.no { color: var(--muted); }
.plans .buy {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.plans .buy .price { font-size: 22px; }
.plans .buy form { margin: 0; }
.login { max-width: 560px; }
.login-alt { margin-top: 18px; }
.login-alt p { margin: 0 0 6px; }
.login ol { padding-left: 1.3em; }

/* Saved searches (searches.html). */
.searches { max-width: 760px; }
.search {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 12px 0;
}
.search.added { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.search h2 { font-size: 1.05rem; margin: 0 0 4px; }
.search h2 a { color: var(--ink); }
.search .meta { margin: 0 0 10px; }
.search .state.on { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; }
.search .state.off { color: var(--warn); }
.search-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.search-actions form { margin: 0; }
.search-actions .rename[open] { flex-basis: 100%; order: 9; }
.search-actions .rename > summary { list-style: none; }
.search-actions .rename > summary::-webkit-details-marker { display: none; }
.search-actions .rename form { display: flex; gap: 8px; margin-top: 8px; }
.search-actions .rename input { flex: 1; min-width: 0; }
.btn-quiet { border-color: transparent; color: var(--muted); }

/* --- the Mini App: the site in Telegram's colours ------------------------------- */

/* telegram-web-app.js puts the user's theme on <html> as --tg-theme-*, and
   tg.js says whether it is dark (.miniapp-dark); the site's own colours give way.
   The fallbacks are Telegram's default light theme. */
html.miniapp {
  color-scheme: light;
  --ground: var(--tg-theme-secondary-bg-color, #efeff4);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --sunk: color-mix(in srgb, var(--tg-theme-hint-color, #8e8e93) 14%, var(--surface));
  --ink: var(--tg-theme-text-color, #000000);
  --muted: var(--tg-theme-hint-color, #8e8e93);
  --line: color-mix(in srgb, var(--tg-theme-hint-color, #8e8e93) 35%, transparent);
  --line-soft: color-mix(in srgb, var(--tg-theme-hint-color, #8e8e93) 18%, transparent);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-ink: var(--tg-theme-accent-text-color, var(--tg-theme-link-color, #2481cc));
  --accent-soft: color-mix(in srgb, var(--tg-theme-button-color, #2481cc) 14%, var(--surface));
  --bad: var(--tg-theme-destructive-text-color, #e53935);
  --deal: #fbe7be;
  --deal-ink: #7a4700;
  --warn: #8a5a00;
  --ok: #1f7a4a;
}
html.miniapp.miniapp-dark {
  color-scheme: dark;
  --deal: #4a3712;
  --deal-ink: #f4cf83;
  --warn: #e8b85a;
  --ok: #6fcf97;
}
.miniapp .btn-primary, .miniapp button.btn-primary, .miniapp a.btn-primary,
.miniapp .btn-primary:hover { color: var(--tg-theme-button-text-color, #ffffff); }
/* Telegram has the header with the bot's name, and the language and the plans
   are in the account menu: the footer and the skip link would only crowd. */
.miniapp .site-foot, .miniapp .skip { display: none; }
.miniapp { --safe-bottom: max(env(safe-area-inset-bottom), var(--tg-safe-area-inset-bottom, 0px)); }
/* While htmx fetches the next page. */
.miniapp body.htmx-request #content { opacity: 0.55; transition: opacity 0.15s; }

/* The Mini App's first page, while it logs in (tg_entry.html). */
.tg-entry-box {
  max-width: 420px; margin: 0 auto; padding: 32vh 16px 0; text-align: center;
}
.tg-entry-box .brand { justify-content: center; margin-bottom: 12px; }

@media (max-width: 640px) {
  .pair { grid-template-columns: 1fr; }
  .counters th { display: none; }
  .side-photos { grid-template-columns: repeat(2, 1fr); }
  .side-photos img { height: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* --- the terms of service: text to read, a column of it ------------------------ */

.tos { max-width: 760px; margin: 8px 0 40px; line-height: 1.6; }
.tos h1 { margin-bottom: 4px; }
.tos h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.tos ul { padding-left: 1.2em; margin: 8px 0; }
.tos li { margin: 4px 0; }

/* --- a flat of the last hour, for a tier that sees the list an hour late ------ */

.fresh { max-width: 640px; margin: 16px auto 40px; }
.fresh h1 { margin: 4px 0 6px; }
.fresh-price { font-family: var(--font-brand); font-size: 28px; font-weight: 700; margin: 0 0 20px; }
.fresh .gate-card { position: static; transform: none; margin: 0; }
