:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --text: #1c2321;
  --muted: #5d6763;
  --border: #dde2de;
  --accent: #1f7a4d;
  --accent-soft: #e3f2ea;
  --warn: #a55a00;
  --warn-soft: #fdf0dc;
  --danger: #b3261e;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121615;
    --surface: #1b211f;
    --text: #e6ebe8;
    --muted: #9aa6a0;
    --border: #2e3734;
    --accent: #5cc690;
    --accent-soft: #1c3428;
    --warn: #f0b060;
    --warn-soft: #3a2a14;
    --danger: #f28b82;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
h1 { margin: 0; font-size: 1.4rem; }
.topbar { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; padding: 16px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; gap: 12px; align-items: center; }
.brand p { margin: 0; color: var(--muted); }
.logo { font-size: 2rem; color: var(--accent); }
.stats { display: flex; gap: 24px; margin: 0; }
.stats div { text-align: right; }
.stats dt { color: var(--muted); font-size: .8rem; }
.stats dd { margin: 0; font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 24px; padding: 24px; max-width: 1400px; margin: 0 auto; }
.filters form { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.layout > * { min-width: 0; }
.filters summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
@media (min-width: 801px) { .filters summary { display: none; } }
input, select { width: 100%; }
input[type=checkbox] { width: auto; }
input, select, button { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 0; }
button { cursor: pointer; background: var(--accent); color: #fff; border-color: var(--accent); }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { flex-shrink: 0; background: none; color: var(--muted); border: none; border-bottom: 2px solid transparent; border-radius: 0; white-space: nowrap; }
.tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
#map { height: 320px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; }
.hint { color: var(--muted); margin-top: 0; }
.cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.card h3 { margin: 0; font-size: 1rem; }
.card .address { color: var(--muted); margin: 0; }
.card .desc { margin: 0; grid-column: 1 / -1; }
.card .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.card .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; font-size: .9rem; }
.score { font-size: 1.4rem; font-weight: 700; color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
.score small { display: block; font-size: .7rem; color: var(--muted); font-weight: 400; }
.tag { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); }
.tag.good { background: var(--accent-soft); border-color: transparent; }
.tag.urgent { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 600; }
.reasons { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; margin: 0; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; }
.empty { color: var(--muted); padding: 24px; text-align: center; background: var(--surface); border-radius: var(--radius); border: 1px dashed var(--border); }
dialog { max-width: 560px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
footer { padding: 24px; text-align: center; color: var(--muted); font-size: .85rem; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .filters form { position: static; }
  .stats { gap: 16px; }
  .stats div { text-align: left; }
  #map { height: 240px; }
}
