:root{--green:#3d6f53;--green-d:#2c5540;--green-l:#e3ebdf;--cream:#f6f2e7;--paper:#fffdf8;--pot:#d9824b;--rust:#a95435;--ink:#24342b;--muted:#5d6b62}
@font-face{font-family:Nunito;src:url(/fonts/nunito.woff2) format("woff2");font-weight:200 1000;font-display:swap}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:Nunito,ui-rounded,"SF Pro Rounded",system-ui,sans-serif;background:var(--cream);color:var(--ink);font-size:16px;display:flex;flex-direction:column}
.top{display:flex;align-items:center;gap:8px;background:var(--green-d);color:var(--cream);padding:calc(10px + env(safe-area-inset-top)) 12px 12px;position:sticky;top:0;z-index:5}
.top h1{flex:1;margin:0;font-size:1.08rem;font-weight:900;text-align:center}
.back,.tab-btn{color:var(--cream);text-decoration:none;font-weight:800;background:rgba(255,255,255,.12);border:0;border-radius:999px;padding:7px 12px;font:inherit;font-weight:800;font-size:.9rem}
main{flex:1;display:flex;flex-direction:column;min-height:0}
main[hidden]{display:none}
.modes{display:flex;gap:6px;padding:10px 10px 4px;overflow-x:auto}
.modes button{flex:1 0 auto;border:1.5px solid var(--green);background:var(--paper);color:var(--green-d);border-radius:999px;padding:8px 11px;font:inherit;font-weight:800;font-size:.86rem}
.modes button[aria-selected=true]{background:var(--green);color:#fff}
.thread{flex:1;overflow-y:auto;padding:10px 12px 16px;display:flex;flex-direction:column;gap:10px}
.msg{max-width:88%;padding:11px 13px;border-radius:18px;line-height:1.45;box-shadow:0 1px 0 rgba(36,52,43,.06),0 6px 16px -12px rgba(36,52,43,.35)}
.msg p{margin:0 0 6px}.msg p:last-child{margin:0}
.msg.user{align-self:flex-end;background:var(--green);color:#fff;border-bottom-right-radius:6px}
.msg.user img{display:block;max-width:180px;border-radius:12px;margin-bottom:6px}
.msg.bot{align-self:flex-start;background:var(--paper);border:1px solid #ebe5d6;border-bottom-left-radius:6px}
.msg.err{background:#fff3ee;border-color:#f0c9b6;color:var(--rust)}
.msg h4{margin:0 0 4px;font-size:1.05rem;color:var(--green-d)}
.msg ul,.msg ol{margin:4px 0 6px;padding-left:20px}
.chip{display:inline-block;font-size:.78rem;font-weight:800;border-radius:999px;padding:2px 9px;background:var(--green-l);color:var(--green-d);margin-left:4px;vertical-align:middle}
.chip.low{background:#fbe7dc;color:var(--rust)}
.fine{font-size:.8rem;color:var(--muted)}
.msg .note{font-size:.78rem;color:var(--muted);margin-top:6px}
.actions{margin-top:8px;display:flex;gap:8px;flex-wrap:wrap}
.actions button,.ghost,menu button{font:inherit;font-weight:800;font-size:.86rem;border-radius:999px;padding:7px 12px;border:1.5px solid var(--green);background:var(--paper);color:var(--green-d)}
.actions button.primary,#saveOk{background:var(--green);color:#fff}
.typing span{display:inline-block;width:7px;height:7px;margin:0 2px;border-radius:50%;background:var(--green);animation:b 1s infinite}
.typing span:nth-child(2){animation-delay:.15s}.typing span:nth-child(3){animation-delay:.3s}
@keyframes b{50%{transform:translateY(-4px);opacity:.5}}
.composer{background:var(--paper);border-top:1px solid #e5dfcf;padding:8px 10px calc(8px + env(safe-area-inset-bottom))}
.row{display:flex;align-items:flex-end;gap:6px}
textarea{flex:1;resize:none;font:inherit;font-size:16px;border:1.5px solid #d9d2c0;border-radius:20px;padding:9px 13px;max-height:120px;background:#fff;color:var(--ink)}
textarea:focus{outline:none;border-color:var(--green)}
.icon-btn{display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:var(--green-l);font-size:1.15rem;cursor:pointer;flex:none}
.send{width:42px;height:42px;border-radius:50%;border:0;background:var(--green);color:#fff;font-size:1.1rem;flex:none}
.send:disabled{opacity:.5}
.count{text-align:right;font-size:.72rem;color:var(--muted);padding:2px 6px 0}
.photo-preview{position:relative;width:84px;margin:0 0 8px}
.photo-preview img{width:84px;height:84px;object-fit:cover;border-radius:14px;border:2px solid var(--green)}
.photo-preview button{position:absolute;top:-8px;right:-8px;width:26px;height:26px;border-radius:50%;border:0;background:var(--ink);color:#fff;font-size:.8rem}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
#plantsView,#plantView{padding:12px 14px;overflow-y:auto}
.plants-head{display:flex;justify-content:space-between;align-items:center}
.plants-head h2{margin:0;color:var(--green-d);font-weight:900}
.plant-list{list-style:none;padding:0;margin:10px 0;display:grid;gap:10px}
.plant-list li button{width:100%;display:flex;gap:12px;align-items:center;text-align:left;background:var(--paper);border:1px solid #ebe5d6;border-radius:18px;padding:10px;font:inherit;color:var(--ink)}
.thumb{width:56px;height:56px;border-radius:14px;object-fit:cover;background:var(--green-l);display:grid;place-items:center;font-size:1.6rem;flex:none}
.plant-list b{display:block;color:var(--green-d)}
.plant-list small{color:var(--muted)}
.ph{margin:10px 0 4px}.ph h2{margin:0;color:var(--green-d);font-weight:900}.ph .sci{font-style:italic;color:var(--muted)}
.timeline{list-style:none;padding:0;margin:12px 0;display:grid;gap:12px}
.timeline li{background:var(--paper);border:1px solid #ebe5d6;border-radius:18px;padding:12px;border-left:5px solid var(--green)}
.timeline li.diagnose{border-left-color:var(--pot)}
.timeline img{width:100%;max-height:220px;object-fit:cover;border-radius:12px;margin-bottom:8px}
.timeline .when{font-size:.78rem;color:var(--muted);font-weight:800}
.timeline .kind{font-weight:900;color:var(--green-d)}
dialog{border:0;border-radius:20px;padding:18px;width:min(340px,92vw);background:var(--paper)}
dialog h3{margin:0 0 10px;color:var(--green-d)}
dialog label{display:block;font-weight:800;font-size:.9rem;margin:8px 0}
dialog select,dialog input{display:block;width:100%;margin-top:4px;font:inherit;font-size:16px;padding:8px;border-radius:12px;border:1.5px solid #d9d2c0;background:#fff}
menu{display:flex;justify-content:flex-end;gap:8px;padding:0;margin:14px 0 0}
.empty{color:var(--muted);text-align:center;padding:30px 10px}
.msg.cta{background:#fff8e6;border:1px solid #eed9a3}
.btnlink{display:inline-block;text-decoration:none;font-weight:800;border-radius:999px;padding:9px 14px;border:2px solid #2c5540;color:#2c5540;margin:4px 6px 0 0}
.btnlink.primary{background:#2c5540;color:#fff}

.thinking{display:flex;align-items:center;gap:10px}.thinking .tlabel{font-size:.92rem;color:var(--muted,#4a5a4f)}
@media (prefers-reduced-motion:reduce){.typing span{animation:none}}
/* follow-up: a few quick questions + extra photos */
.msg.followup{border:1.5px solid #eed9a3;background:#fff8e6}
.msg.followup .badge{margin:0 0 4px;font-weight:900;color:#8a5a00;font-size:.85rem}
.fuq{margin:8px 0}.fuq p{margin:0 0 6px}
.fuq .chips{display:flex;flex-wrap:wrap;gap:8px}
.fuq .chip{margin:0;font-size:.88rem;padding:9px 13px;min-height:44px;display:inline-flex;align-items:center;gap:4px;border:1.5px solid var(--green);background:var(--paper);color:var(--green-d);cursor:pointer;font-family:inherit}
.fuq .chip[aria-pressed=true],.fuq .chip.on{background:var(--green);color:#fff}
.fuq .chip.photo .fine{color:inherit;opacity:.8;font-weight:600}
.msg.user .thumbs{display:flex;gap:6px;flex-wrap:wrap}.msg.user .thumbs img{width:64px;height:64px;object-fit:cover;margin:0;max-width:none}
.fuq .chip.photo{display:inline-block;text-align:left;line-height:1.35}
