:root {
  --bg: #f6f6f4; --card: #ffffff; --text: #1a1a1a; --muted: #6b6b6b;
  --accent: #7048e8; --badge: #eef; --border: #e3e3df;
  --new: #0a7d33;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a; --card: #222226; --text: #ececec; --muted: #9a9aa2;
    --accent: #a58bff; --badge: #2c2c3a; --border: #333338;
    --new: #4ade80;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif; }
header { padding: 1.2rem 1.5rem .8rem; max-width: 1280px; margin: 0 auto; }
h1 { margin: 0 0 .1rem; font-size: 1.5rem; }
#meta { margin: 0 0 .8rem; color: var(--muted); font-size: .85rem; }
nav { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.tab { background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: .35rem .9rem; font-size: .9rem; cursor: pointer; color: var(--text); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
select, .chk { font-size: .85rem; color: var(--text); background: var(--card);
  border: 1px solid var(--border); border-radius: 8px; padding: .3rem .5rem; }
.chk { display: inline-flex; align-items: center; gap: .35rem; }
#whoami { border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: .35rem .8rem; cursor: pointer; font-size: .85rem; }

main { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem; padding: 1rem 1.5rem 3rem; max-width: 1280px; margin: 0 auto; }
#empty { text-align: center; color: var(--muted); padding: 3rem; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column; position: relative; }
.photo { position: relative; aspect-ratio: 3/2; background: #00000014; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .navbtn { position: absolute; top: 50%; transform: translateY(-50%);
  background: #000a; color: #fff; border: 0; border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 14px; opacity: 0;
  transition: opacity .15s; }
.photo:hover .navbtn { opacity: 1; }
.navbtn.prev { left: 8px; } .navbtn.next { right: 8px; }
.count { position: absolute; bottom: 8px; right: 10px; background: #000a; color: #fff;
  font-size: .72rem; border-radius: 8px; padding: 1px 7px; }

.num { position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--accent);
  color: #fff; font-weight: 700; border-radius: 10px; padding: 2px 9px; font-size: .9rem; }
.newflag { position: absolute; top: 10px; left: 64px; z-index: 2; background: var(--new);
  color: #fff; border-radius: 10px; padding: 2px 8px; font-size: .75rem; font-weight: 600; }

.body { padding: .75rem .9rem .9rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.price { font-size: 1.15rem; font-weight: 700; }
.addr { font-weight: 600; }
.specs { color: var(--muted); font-size: .85rem; }
.badges { display: flex; gap: .35rem; flex-wrap: wrap; }
.badge { background: var(--badge); border-radius: 7px; padding: 1px 8px; font-size: .76rem; }
.badge.avail { font-weight: 600; }
.summary { color: var(--muted); font-size: .82rem; display: -webkit-box;
  -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card a.zlink { margin-top: auto; text-decoration: none; color: var(--accent);
  font-weight: 600; font-size: .88rem; }

dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  color: var(--text); max-width: 26rem; padding: 1.2rem 1.4rem; }
dialog::backdrop { background: #0008; }
dialog h2 { font-size: 1rem; margin: .6rem 0 .2rem; }
dialog p { font-size: .85rem; color: var(--muted); margin: .2rem 0 .5rem; }
dialog input { width: 100%; padding: .45rem .6rem; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); }
dialog menu { display: flex; justify-content: flex-end; gap: .5rem; padding: 0; margin: 1rem 0 0; }
dialog button { border-radius: 8px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text); padding: .4rem .9rem; cursor: pointer; }
dialog #setupSave { background: var(--accent); color: #fff; border-color: var(--accent); }
.more { grid-column: 1 / -1; margin: .5rem auto; padding: .55rem 1.6rem; font-size: .95rem;
  border-radius: 999px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); cursor: pointer; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: #000c; color: #fff; padding: .5rem 1rem; border-radius: 10px;
  font-size: .85rem; z-index: 10; }
input[type="date"] { background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: .25rem .4rem; font-size: .85rem; color-scheme: light dark; }
.filters { display: flex; gap: .5rem .6rem; align-items: center; flex-wrap: wrap; }
.group { display: inline-flex; gap: .4rem; align-items: center; font-size: .85rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: .18rem .5rem; }
.group .chk { border: 0; background: none; padding: 0; }
input[type="number"] { width: 4.6rem; background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: .2rem .3rem; font-size: .85rem; }
#count { margin: .5rem 0 0; font-weight: 600; }
#viewToggle { border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 999px; padding: .35rem .9rem; cursor: pointer; font-size: .9rem; }
#map { height: calc(100vh - 220px); min-height: 420px; max-width: 1280px;
  margin: 1rem auto 2rem; border-radius: 14px; z-index: 0; }
.leaflet-popup-content { font: 13px/1.4 -apple-system, sans-serif; }
.goneflag { position: absolute; top: 10px; left: 64px; z-index: 2; background: #b91c1c;
  color: #fff; border-radius: 10px; padding: 2px 8px; font-size: .72rem; font-weight: 700; }
.card.gone .photo img { filter: grayscale(.9) brightness(.75); }
.heart { position: absolute; top: 8px; right: 8px; z-index: 2; background: #000a;
  border: 0; border-radius: 50%; width: 38px; height: 38px; font-size: 19px;
  cursor: pointer; color: #fff; }
.heart.on { color: #ff5c8a; }
.hearts-by { font-size: .8rem; color: #ff5c8a; }
.tt { display: flex; flex-direction: column; gap: 1px; font-size: .78rem; color: var(--muted);
  background: var(--badge); border-radius: 8px; padding: .3rem .55rem; }
.ttrow b { color: var(--text); font-weight: 600; }
#tabs { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; }
#whoDialog { border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  color: var(--text); padding: 1.2rem 1.6rem; }
#whoDialog::backdrop { background: #0008; }
#whoDialog menu { display: flex; gap: .8rem; padding: 0; margin: 1rem 0 0; }
#whoDialog button { border-radius: 10px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text); padding: .6rem 1.6rem; cursor: pointer; font-size: 1rem; }
