:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --text: #1d2420;
  --muted: #66706a;
  --border: #e3dccd;
  --accent: #1f5c4a;
  --accent-text: #ffffff;
  --good: #1f7a4d;
  --ok: #a06a00;
  --bad: #b23a2e;
  --chip: #efe8da;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 14px rgba(0, 0, 0, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141816;
    --surface: #1d2320;
    --text: #e9ece9;
    --muted: #9aa49e;
    --border: #2e3632;
    --accent: #5fbf9a;
    --accent-text: #0e1512;
    --good: #5fbf9a;
    --ok: #e0b050;
    --bad: #ef7d70;
    --chip: #28302c;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; margin-top: 1.25rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; gap: .25rem; align-items: center; overflow-x: auto;
  padding: .5rem 1rem; background: var(--accent); color: var(--accent-text);
}
.bar a { color: var(--accent-text); text-decoration: none; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap; }
.bar a.on, .bar a:hover { background: rgba(255, 255, 255, .16); }
.bar .brand { font-weight: 700; margin-right: .5rem; }
.bar .spacer { flex: 1; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; padding: 0 .4rem; font-size: .75rem; margin-left: .2rem; }

main { max-width: 980px; margin: 0 auto; padding: 1rem; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
select, input[type=text], input[type=password], textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: .45rem .6rem;
}
textarea { width: 100%; min-height: 4rem; }
button, .button {
  font: inherit; cursor: pointer; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: .45rem .8rem; text-decoration: none; display: inline-block;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
label.check { display: flex; gap: .3rem; align-items: center; }

/* property cards */
.cards { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column;
}
.card .photo { position: relative; aspect-ratio: 3 / 2; background: var(--chip); }
.card .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .body { padding: .7rem .8rem .8rem; display: flex; flex-direction: column; gap: .35rem; }
.card .price { font-weight: 700; font-size: 1.1rem; }
.card.rejected { opacity: .55; }
.score {
  position: absolute; top: .5rem; left: .5rem; min-width: 2.6rem; text-align: center;
  font-weight: 800; padding: .2rem .45rem; border-radius: 8px; color: #fff; background: var(--bad);
}
.score.hi { background: var(--good); }
.score.mid { background: var(--ok); }
.status-pill {
  position: absolute; top: .5rem; right: .5rem; font-size: .75rem; font-weight: 600;
  padding: .15rem .5rem; border-radius: 99px; background: rgba(0, 0, 0, .6); color: #fff; text-transform: capitalize;
}
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { background: var(--chip); border-radius: 99px; padding: .1rem .55rem; font-size: .8rem; }
.chip.warn { background: color-mix(in srgb, var(--ok) 22%, transparent); }
.chip.bad { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.chip.good { background: color-mix(in srgb, var(--good) 22%, transparent); }

/* property page */
.gallery { display: flex; gap: .4rem; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 12px; }
.gallery img { height: 240px; border-radius: 8px; scroll-snap-align: start; flex: none; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1rem; margin-top: 1rem; }
.statuses { display: flex; flex-wrap: wrap; gap: .4rem; }
.statuses button { text-transform: capitalize; }
.statuses button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: .35rem .3rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.bar-meter { height: 6px; background: var(--chip); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar-meter > div { height: 100%; background: var(--accent); }
.description { white-space: pre-line; }
details summary { cursor: pointer; color: var(--accent); }
.note { border-left: 3px solid var(--accent); padding: .2rem .6rem; margin: .5rem 0; }

#map { height: calc(100vh - 140px); min-height: 400px; border-radius: 12px; }

.login { max-width: 340px; margin: 12vh auto; display: flex; flex-direction: column; gap: .6rem; }
.error { color: var(--bad); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
