:root {
  --bg: #f5f3ee; --card: #ffffff; --ink: #1d221f; --muted: #6a716c; --line: #e2ddd3;
  --accent: #2f6b4f; --accent-ink: #fff; --warn: #c7771a; --bad: #b8322a; --ok: #2f8a4f;
  --top: #1f2a24; --top-ink: #f1efe8; --shadow: 0 2px 10px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151917; --card: #1f2522; --ink: #e8e6df; --muted: #9aa29c; --line: #313a35;
    --accent: #5fae86; --accent-ink: #0d1310; --top: #0f1311; --shadow: 0 2px 10px rgba(0,0,0,.4); }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
.hidden { display: none !important; }

.top { position: fixed; top: 0; left: 0; right: 0; height: 52px; z-index: 1000; display: flex; align-items: center;
  justify-content: space-between; padding: 0 14px; background: var(--top); color: var(--top-ink); }
.brand { color: var(--top-ink); text-decoration: none; font-weight: 700; font-size: 17px; }
.top-right { display: flex; gap: 10px; align-items: center; }
.live { width: 9px; height: 9px; border-radius: 50%; background: #777; }
.live.on { background: #4ade80; box-shadow: 0 0 6px #4ade80; }

main { position: fixed; top: 52px; bottom: 62px; left: 0; right: 0; overflow-y: auto; }
main.full { overflow: hidden; }
.page { max-width: 900px; margin: 0 auto; padding: 16px 16px 90px; }
h2 { margin: 4px 0 12px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 16px; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; height: 62px; z-index: 1000; display: flex;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-decoration: none; color: var(--muted); font-size: 11px; position: relative; }
.tabs a span { font-size: 20px; }
.tabs a.active { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 6px; left: 55%; background: var(--bad); color: #fff; border-radius: 9px;
  font-size: 10px; padding: 1px 5px; }

.fab { position: fixed; right: 18px; bottom: 78px; z-index: 1001; width: 58px; height: 58px; border-radius: 50%;
  border: none; background: var(--accent); color: var(--accent-ink); font-size: 30px; box-shadow: 0 4px 14px rgba(0,0,0,.3); cursor: pointer; }
.fab-menu { position: fixed; right: 18px; bottom: 146px; z-index: 1001; display: flex; flex-direction: column; gap: 8px; }
.fab-menu button { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 22px;
  padding: 10px 16px; font-size: 15px; box-shadow: var(--shadow); cursor: pointer; text-align: left; }

#map { position: absolute; inset: 0; }
.map-legend { position: absolute; left: 10px; bottom: 10px; z-index: 500; background: var(--card); color: var(--ink);
  border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: var(--shadow); max-width: 60%; }
.map-legend label { display: flex; gap: 6px; align-items: center; margin: 2px 0; cursor: pointer; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; vertical-align: middle; }
.map-btn { position: absolute; right: 10px; top: 10px; z-index: 500; }
.stats { display: flex; gap: 6px; flex-wrap: wrap; position: absolute; left: 50px; right: 60px; top: 10px; z-index: 500; pointer-events: none; }
.stat { background: var(--card); border-radius: 8px; padding: 4px 8px; font-size: 12px; box-shadow: var(--shadow); }
.stat b { font-size: 14px; }

.cat-marker { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #999; background: #ccc center/cover;
  box-shadow: 0 1px 5px rgba(0,0,0,.5); }
.col-marker { font-size: 26px; text-shadow: 0 0 3px #fff; }
.alert-marker { font-size: 24px; }
.s-marker { width: 12px; height: 12px; border-radius: 50%; background: #7c6cf0; border: 2px solid #fff; }

.leaflet-popup-content { margin: 10px; min-width: 180px; }
.pop img { width: 100%; border-radius: 8px; max-height: 160px; object-fit: cover; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat-card { padding: 0; overflow: hidden; cursor: pointer; text-decoration: none; color: inherit; }
.cat-card img, .cat-card .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--line); }
.cat-card .noimg { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.cat-card .info { padding: 8px 10px; }
.cat-card .name { font-weight: 600; }
.list > * + * { margin-top: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.muted { color: var(--muted); font-size: 13px; }

.pill { display: inline-block; border-radius: 10px; padding: 1px 8px; font-size: 12px; font-weight: 600; color: #fff; background: #888; }
.st-neutered_returned, .st-neutered { background: var(--ok); }
.st-needs_tnr { background: var(--warn); }
.st-trapped { background: #3b74c4; }
.st-adopted { background: #c2417a; }
.st-deceased { background: #555; }
.st-unknown { background: #888; }
.fed-ok { color: var(--ok); } .fed-warn { color: var(--warn); } .fed-bad { color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 16px; padding: 5px 11px;
  font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

form label, .field { display: block; margin: 10px 0 4px; font-weight: 600; font-size: 13px; }
input, select, textarea { width: 100%; font: inherit; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); }
textarea { min-height: 70px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn { display: inline-block; border: none; border-radius: 9px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; text-align: center; }
.btn.ghost { background: transparent; border: 1px solid currentColor; color: inherit; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.warn { background: var(--bad); color: #fff; }
.btn.block { display: block; width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .6; cursor: wait; }

.modal { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 700px) { .modal { align-items: center; } }
.modal-box { position: relative; background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px 24px; }
@media (min-width: 700px) { .modal-box { border-radius: 16px; } }
.modal-x { position: absolute; right: 10px; top: 10px; border: none; background: var(--line); color: var(--ink);
  width: 32px; height: 32px; border-radius: 50%; font-size: 16px; cursor: pointer; z-index: 2; }
.mini-map { height: 220px; border-radius: 10px; margin-top: 6px; border: 1px solid var(--line); }
.photo-pick { display: flex; align-items: center; justify-content: center; min-height: 150px; border: 2px dashed var(--line);
  border-radius: 12px; cursor: pointer; overflow: hidden; background: var(--card); }
.photo-pick img { width: 100%; max-height: 300px; object-fit: contain; }
.loc-status { font-size: 13px; margin-top: 4px; }

.match { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: start; }
.match img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; }
.big-pct { font-size: 30px; font-weight: 800; line-height: 1; }
.pct-hi { color: var(--ok); } .pct-mid { color: var(--warn); } .pct-lo { color: var(--muted); }
.bars { display: grid; grid-template-columns: 95px 1fr 38px; gap: 3px 6px; font-size: 12px; align-items: center; margin-top: 6px; }
.bar { height: 7px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.vs figure { margin: 0; text-align: center; font-size: 12px; }
.vs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; }
.popup-head { text-align: center; margin-bottom: 10px; }

.hold-banner { background: var(--bad); color: #fff; border-radius: 10px; padding: 10px 12px; font-weight: 600; margin: 8px 0; }
.hold-banner small { display: block; font-weight: 400; opacity: .9; }
.hold-marker { font-size: 26px; filter: drop-shadow(0 0 4px #b8322a); }
.tnr-by { background: color-mix(in srgb, var(--ok) 15%, transparent); border-left: 3px solid var(--ok); padding: 4px 8px; border-radius: 6px; font-size: 13px; margin-top: 6px; }
.lost-box { border: 2px solid #8a4fc4; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.thumbs img { width: 70px; height: 70px; object-fit: cover; border-radius: 8px; }
.photo-pick.multi { min-height: 110px; flex-wrap: wrap; gap: 6px; padding: 6px; }
.photo-pick.multi img { width: 31%; height: 110px; object-fit: cover; border-radius: 8px; }
.offline-bar { position: fixed; top: 52px; left: 0; right: 0; z-index: 999; background: var(--warn); color: #fff; text-align: center; font-size: 13px; padding: 4px; }
.queue { background: var(--warn); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 7px; }
.section-links a { display: block; padding: 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.section-links a b { float: right; color: var(--bad); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 3px; }
.voucher-file { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 3000; background: var(--top); color: var(--top-ink);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 90%; }
.timeline { border-left: 3px solid var(--line); padding-left: 12px; }
.timeline > div { margin-bottom: 8px; }
.hero { width: 100%; max-height: 340px; object-fit: cover; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { padding: 6px; border-bottom: 1px solid var(--line); text-align: left; }

.map-legend input[type=checkbox] { width: auto; margin: 0; flex: none; }

/* picture pickers (coat, eyes) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; margin-top: 4px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border: 2px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font: inherit; font-size: 11px; line-height: 1.2; cursor: pointer; text-align: center; }
.tile.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--card)); font-weight: 600; }
.tile-q { font-size: 30px; line-height: 56px; color: var(--muted); }
.advice { background: color-mix(in srgb, var(--warn) 14%, var(--card)); border-left: 3px solid var(--warn); padding: 6px 10px; border-radius: 6px; font-size: 13px; margin: 6px 0; }
.draft-note { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 8px; border-color: var(--accent); }
/* map markers: cats = round photos (ring = TNR status); colonies = purple squares; trapping = red square */
.col-pin { width: 34px; height: 34px; border-radius: 8px; background: #6b3fa0; border: 2px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; font-size: 18px; }
.col-pin.trap { background: #b8322a; animation: trapPulse 1.4s infinite; }
@keyframes trapPulse { 50% { box-shadow: 0 0 0 7px rgba(184,50,42,.25); } }
.cat-pile { width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 3px solid #1f2a24; box-shadow: 0 1px 5px rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; gap: 1px; font-size: 15px; color: #1f2a24; }
.cat-pile b { font-size: 15px; }
.lg-cat { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #2f8a4f; background: #ccc; vertical-align: middle; }
.lg-col, .lg-trap { display: inline-flex; width: 16px; height: 16px; border-radius: 4px; background: #6b3fa0; font-size: 10px; align-items: center; justify-content: center; vertical-align: middle; }
.lg-trap { background: #b8322a; }
.feeders { margin: 6px 0; display: grid; gap: 3px; }
.link-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.install-top { margin-right: 6px; }
@media (max-width: 520px) { .install-label { display: none; } .install-top { padding: 4px 9px; font-size: 16px; } }
.brand { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.coat-group { margin: 8px 0 4px; }
.coat-how { font-size: 13px; color: var(--muted); }
.coat-how b { color: var(--ink); }
.coat-inline { display: inline-flex; align-items: center; gap: 6px; }
.why { display: grid; grid-template-columns: auto auto 60px auto 1fr; gap: 4px 8px; align-items: center; font-size: 13px; margin-top: 8px; }
.why .muted { font-size: 12px; }
.howpct { margin-top: 8px; font-size: 13px; } .howpct summary { cursor: pointer; color: var(--accent); }
.howpct ol { margin: 6px 0 0; padding-left: 20px; }
.pct-mean { font-weight: 600; font-size: 13px; margin-top: 2px; }
@media (max-width: 480px) { .why { grid-template-columns: auto auto 1fr auto; } .why .muted { grid-column: 2 / -1; margin-bottom: 4px; } }

.breed-tile img { width: 72px; height: 64px; object-fit: contain; }
.acks { font-size: 13px; margin-top: 6px; }
.quick-tnr { margin-top: 10px; }

.wx-good { font-size: 14px; }
.wx-grid { display: grid; grid-template-columns: auto auto auto 1fr; gap: 2px 10px; font-size: 12px; margin-top: 6px; }
.wx-bad { color: var(--bad); } .wx-ok { color: var(--ok); }

.wx-now { margin: 6px 0; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.wx-now.good { background: color-mix(in srgb, var(--ok) 14%, var(--card)); }
.wx-now.bad { background: color-mix(in srgb, var(--bad) 14%, var(--card)); }
.feeder-note { margin-left: 22px; }
.trapday { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.td-cat { display: flex; gap: 8px; align-items: center; cursor: pointer; padding: 8px; }
.td-cat input { width: 22px; height: 22px; flex: none; }
.td-cat img, .td-cat .noimg { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; display: flex; align-items: center; justify-content: center; }
.td-cat:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.td-steps { position: sticky; bottom: 70px; }

/* place / address search in the location picker */
.geo-row { display: flex; gap: 6px; margin-bottom: 6px; }
.geo-row .geo-q { flex: 1; min-width: 0; margin: 0; }
.geo-res { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.geo-hit { text-align: left; display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line, #3334); background: var(--card, #fff1); color: inherit; cursor: pointer; }
.geo-hit .muted { font-size: 12px; }

.thumbs img { cursor: pointer; }
.videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.videos video { width: 100%; max-height: 320px; border-radius: 8px; background: #000; }
