:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --line: #e4e2dd;
  --accent: #1f6f5c;
  --accent-soft: #e3f1ec;
  --bad: #b3412e;
  --bad-soft: #fbe9e5;
  --warn: #a86a00;
  --warn-soft: #fdf2dc;
  --good: #2e7d4f;
  --good-soft: #e4f3ea;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 28px; }
h2 { font-size: 20px; margin-top: 1.4em; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1000;
}
.brand { font-weight: 800; font-size: 22px; color: var(--ink); letter-spacing: -.5px; display: inline-flex; align-items: center; }
.brand .logo { width: 26px; height: 26px; color: var(--accent); margin-right: 8px; flex-shrink: 0; }
.brand .w2 { color: var(--accent); }
.brand:hover { text-decoration: none; }
.tagline { color: var(--muted); font-size: 13px; flex: 1; }
main { max-width: 1100px; margin: 0 auto; padding: 24px; }
.footer { max-width: 1100px; margin: 0 auto; padding: 8px 24px 40px; color: var(--muted); font-size: 12px; }

.btn {
  display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; font: inherit; font-weight: 600;
}
.btn:hover { text-decoration: none; border-color: #c9c6bf; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #185a4a; }
.btn-link { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
.btn-link:hover { color: var(--ink); text-decoration: underline; }
.btn-link.danger { color: var(--bad); }
.btn-link.danger:hover { color: #8a2f20; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1.3fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .tagline { display: none; } }

.search { width: 100%; padding: 12px 14px; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
#map { height: 420px; border-radius: var(--radius); border: 1px solid var(--line); }
#map.small-map { height: 240px; }

/* Zillow-style label pins */
.pin {
  position: relative; margin-bottom: 6px;
  padding: 3px 8px; border-radius: 6px; font: 700 12px/1.2 -apple-system, "Segoe UI", Roboto, sans-serif;
  color: #fff; white-space: nowrap; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer;
  border: 1.5px solid #fff; transition: transform .12s;
}
/* Leaflet anchors the icon's top-left at the point; Google anchors bottom-center itself. */
.leaflet-marker-icon .pin { transform: translate(-50%, calc(-100% - 6px)); margin-bottom: 0; }
.pin::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -5px;
  border: 5px solid transparent; border-bottom: 0; border-top-color: inherit;
}
.pin-good { background: #2e7d4f; border-top-color: #2e7d4f; }
.pin-mid { background: #a86a00; }
.pin-warn { background: #d08a2b; }
.pin-bad { background: #b3412e; }
.pin-neutral { background: #1f6f5c; }
.pin-good::after { border-top-color: #2e7d4f; }
.pin-mid::after { border-top-color: #a86a00; }
.pin-warn::after { border-top-color: #d08a2b; }
.pin-bad::after { border-top-color: #b3412e; }
.pin-neutral::after { border-top-color: #1f6f5c; }
.pin-dot { width: 11px; height: 11px; padding: 0; border-radius: 50%; background: #5f7f76; border-width: 2px; margin-bottom: 0; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.pin-dot::after { display: none; }
.leaflet-marker-icon .pin-dot { transform: translate(-50%, -50%); }
.pin-hl { background: #1d1d1f !important; z-index: 10; }
.pin-dot.pin-hl { width: 16px; height: 16px; }
.pin-hl::after { border-top-color: #1d1d1f !important; }
.leaflet-marker-icon .pin-hl, .pin-hl { outline: 2px solid #fff; }
.map-pop { font-size: 13px; line-height: 1.5; }
.row:hover { background: #fafaf7; }

.list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.row:hover { border-color: var(--accent); text-decoration: none; }
.row .name { font-weight: 600; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-neutral { background: #efeee9; color: var(--muted); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stats { display: flex; gap: 24px; flex-wrap: wrap; margin: 12px 0; }
.stat .v { font-size: 24px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.stars { color: #e0a100; letter-spacing: 1px; }

.alert { border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.alert-bad { background: var(--bad-soft); border: 1px solid #f0c9c0; }
.alert-info { background: #eef3f8; border: 1px solid #d5e0ec; }

.bar { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar .track { flex: 1; height: 8px; background: #efeee9; border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--bad); }
.bar .lbl { width: 210px; flex-shrink: 0; }
.bar .n { width: 40px; text-align: right; color: var(--muted); }

.deficiency { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.deficiency:last-child { border-bottom: none; }

.buildings { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.bld { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.bld:hover { border-color: var(--accent); text-decoration: none; }
.bld .t { font-weight: 700; font-size: 16px; }

.review { padding: 16px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: none; }
.review-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.review .where { font-weight: 700; }
.review p { margin: 8px 0; white-space: pre-wrap; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.photo { position: relative; }
.photo img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.photo .badge { position: absolute; left: 4px; bottom: 4px; font-size: 10px; background: rgba(0,0,0,.65); color: #fff; padding: 1px 5px; border-radius: 4px; }
.owner-reply { margin-top: 8px; padding: 10px 12px; background: #f3f2ee; border-left: 3px solid var(--muted); border-radius: 6px; font-size: 14px; }
.ratings-mini { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.ratings-mini b { color: var(--ink); }
.flagged { opacity: .55; }

/* form */
.form { display: flex; flex-direction: column; gap: 18px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=month], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
.row-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .row-fields { grid-template-columns: 1fr; } }
.tagpick { display: flex; flex-wrap: wrap; gap: 6px; }
.tagpick label { font-weight: 500; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 13px; margin: 0; background: #fff; }
.tagpick input { display: none; }
.tagpick.neg input:checked + span { color: var(--bad); }
.tagpick.neg label:has(input:checked) { background: var(--bad-soft); border-color: #f0c9c0; }
.tagpick.pos label:has(input:checked) { background: var(--good-soft); border-color: #bfe0cb; }
.rate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; }
.rate { display: flex; justify-content: space-between; align-items: center; }
.rate .starpick { display: flex; gap: 2px; }
.starpick button { background: none; border: none; font-size: 22px; color: #d8d5cd; cursor: pointer; padding: 0 1px; line-height: 1; }
.starpick button.on { color: #e0a100; }
.photo-req { padding: 12px; border-radius: 10px; border: 1px dashed var(--line); }
.photo-req.required { border-color: var(--bad); background: var(--bad-soft); }
.error { color: var(--bad); font-weight: 600; }
.radio-line { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-line label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; margin: 0; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 2000; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 90vh; border-radius: 8px; }

.google-card { border-style: dashed; }
.sent { text-align: center; padding: 8px 4px; }
.sent-icon { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.sent h2 { margin: 0 0 8px; }
.sent p { margin: 6px 0; }
.sent-actions { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 16px; }
.btn:disabled { opacity: .55; cursor: default; }
.empty { padding: 20px; text-align: center; color: var(--muted); }
