:root {
  --bg: #f6f5ef; --fg: #1f2a1f; --muted: #6b7266; --card: #fff; --line: #dcdcd2;
  --ok: #e9eee4; --watch: #8fb8e8; --replace: #f2c94c; --planted: #6fbf73; --accent: #2f5d34;
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); padding-bottom: env(safe-area-inset-bottom); }
header { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--accent); color: #fff; }
#sync { font-size: 13px; padding: 3px 8px; border-radius: 10px; }
#sync.warn { background: #f2c94c; color: #222; }
#sync.okc { background: rgba(255,255,255,.18); }
main { padding: 12px; max-width: 720px; margin: 0 auto; }
button, input, textarea { font: inherit; }
button { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 14px; cursor: pointer; color: var(--fg); }
button:disabled { opacity: .35; }
.big { width: 100%; padding: 16px; margin: 12px 0; background: var(--accent); color: #fff; border: 0; font-weight: 600; }
.card { background: var(--card); padding: 20px; border-radius: 14px; display: grid; gap: 14px; margin-top: 30px; }
label { display: grid; gap: 6px; }
input, textarea { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: 100%; }
textarea { min-height: 70px; }
.err { color: #b00020; min-height: 1em; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0; }

.s-ok { background: var(--ok); } .s-watch { background: var(--watch); }
.s-replace { background: var(--replace); } .s-planted { background: var(--planted); }
svg .col { fill: var(--ok); } svg .s-watch { fill: var(--watch); } svg .s-replace { fill: var(--replace); } svg .s-planted { fill: var(--planted); }
svg text { font-size: 6px; text-anchor: middle; fill: var(--muted); }
#map { width: 100%; height: auto; max-height: 62vh; background: var(--card); border-radius: 12px; padding: 6px; touch-action: manipulation; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { border: 0; border-radius: 12px; padding: 10px; font-size: 26px; font-weight: 700; text-align: center; display: grid; }
.stat small { font-size: 12px; font-weight: 500; }
#search { display: flex; gap: 8px; margin: 10px 0 0; }

.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bar h2 { flex: 1; margin: 0; font-size: 20px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; margin-bottom: 10px; }
.legend span { padding: 3px 8px; border-radius: 8px; }
.trees { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.tree { height: 58px; font-size: 20px; font-weight: 600; border: 0; position: relative; }
.tree i { position: absolute; top: 2px; right: 6px; font-style: normal; }

dialog { width: min(96vw, 560px); overflow-x: hidden; max-height: 92vh; border: 0; border-radius: 16px; padding: 14px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.choices label { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 58px; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 15px; border: 3px solid transparent; cursor: pointer; }
.choices label:has(input:checked) { border-color: var(--fg); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.choices label:has(input:checked)::before { content: '✓ '; }
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.photo { margin-top: 10px; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; }
.hist { list-style: none; padding: 0; display: grid; gap: 10px; }
.hist li { background: var(--bg); padding: 10px; border-radius: 10px; }
.hist small { display: block; color: var(--muted); }
.hist img { max-width: 100%; border-radius: 8px; margin-top: 6px; }
.hist .undone { opacity: .45; text-decoration: line-through; }
.hist .undo { color: var(--muted); font-size: 14px; }
.undo-btn { margin-top: 6px; font-size: 14px; padding: 6px 10px; }
.pill { padding: 2px 8px; border-radius: 8px; font-size: 14px; white-space: nowrap; display: inline-block; }

.actions { display: flex; gap: 8px; }
.actions button { flex: 1; }
.lrow { background: var(--card); padding: 10px; border-radius: 10px; margin: 6px 0; }
.lrow a { text-decoration: underline; cursor: pointer; }

#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222; color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 10; display: flex; gap: 12px; align-items: center; }
#toast[hidden] { display: none; }
#toast button { background: transparent; color: #f2c94c; border-color: #f2c94c; padding: 6px 10px; }

@media print {
  header, .bar, .actions, #toast { display: none !important; }
  body, .lrow { background: #fff; }
  .print a { text-decoration: none; color: #000; }
}
