:root {
  --green: #2f6b3f;
  --green-2: #4c9a5c;
  --green-bg: #eef5ee;
  --bg: #f7f6f1;
  --card: #fff;
  --text: #1f2a22;
  --muted: #6b766d;
  --line: #e2e4dc;
  --danger: #b3412e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--green); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 24px 16px; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--green); color: #fff;
}
.logo { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; white-space: nowrap; }
.logo img { width: 30px; height: 30px; background: #fff; border-radius: 8px; padding: 2px; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: #e3f0e5; text-decoration: none; padding: 6px 10px; border-radius: 999px; font-size: 15px; }
.top nav a.on { background: rgba(255,255,255,.18); color: #fff; }

main { max-width: 860px; margin: 0 auto; padding: 16px 16px 100px; }
h1 { font-size: 24px; margin: 4px 0 12px; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 16px; margin: 18px 0 8px; color: var(--muted); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 999px; padding: 9px 16px; font: inherit; font-size: 15px; cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: #c9ccc1; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #275a35; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.link { border: 0; background: none; color: var(--green); padding: 4px 6px; }
.btn:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

.fab {
  position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 5;
  box-shadow: 0 6px 18px rgba(30, 60, 35, .3); padding: 14px 20px; font-size: 16px;
}

/* plant grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--card); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(0,0,0,.07); display: flex; flex-direction: column; }
.tile .ph { aspect-ratio: 1; background: var(--green-bg); display: flex; align-items: center; justify-content: center; font-size: 46px; }
.tile .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .t { padding: 8px 10px 10px; }
.tile .n { font-weight: 600; line-height: 1.25; }
.tile .s { font-size: 13px; color: var(--muted); }

.empty { background: var(--card); border-radius: var(--radius); padding: 32px 20px; text-align: center; }
.empty .big { font-size: 54px; }

/* forms */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
label.f { display: block; margin: 0 0 14px; }
label.f > span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--green-2); outline-offset: -1px; border-color: transparent; }
.err { color: var(--danger); margin: 8px 0; }
.photo-pick {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  aspect-ratio: 4/3; max-height: 320px; width: 100%; border: 2px dashed #c4cfc4; border-radius: var(--radius);
  background: var(--green-bg); color: var(--green); cursor: pointer; overflow: hidden; position: relative; font-weight: 600;
}
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick input { display: none; }
.photo-pick .ic { font-size: 40px; }
.small-pick { aspect-ratio: auto; height: 120px; max-width: 200px; font-size: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }

/* plant page */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 700px) { .hero { grid-template-columns: 320px minmax(0, 1fr); } }
.hero .ph { border-radius: var(--radius); overflow: hidden; background: var(--green-bg); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 80px; }
.hero .ph img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.facts { margin: 0; }
.facts div { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); min-width: 120px; }
.facts dd { margin: 0; white-space: pre-wrap; }
.banner { background: #fff4e0; border: 1px solid #f0d9a8; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }

.advice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.advice .a { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.advice .a b { display: block; margin-bottom: 4px; }
.advice .a p { margin: 0; white-space: pre-wrap; }
.wait { display: flex; align-items: center; gap: 10px; background: var(--green-bg); border-radius: var(--radius); padding: 14px; }
.spin { width: 20px; height: 20px; border: 3px solid #b9d3bd; border-top-color: var(--green); border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ev { background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; gap: 12px; }
.ev .ic { font-size: 24px; line-height: 1; padding-top: 2px; }
.ev .body { flex: 1; min-width: 0; }
.ev .h { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.ev .k { font-weight: 600; }
.ev .d { color: var(--muted); font-size: 14px; }
.ev .note { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev img { margin-top: 8px; max-width: 220px; width: 100%; border-radius: 10px; cursor: zoom-in; display: block; }
.ev .acts { margin-top: 6px; display: flex; gap: 4px; }

.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; z-index: 60; background: #24312a; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 15px; max-width: 90vw; }

.auth { max-width: 380px; margin: 8vh auto 0; }
.auth .logo-big { text-align: center; font-size: 26px; font-weight: 700; color: var(--green); margin-bottom: 16px; }
.auth .logo-big img { width: 72px; height: 72px; display: block; margin: 0 auto 8px; }
@media (max-width: 380px) {
  .logo { font-size: 16px; }
  .top nav a { padding: 6px 7px; font-size: 14px; }
}
@media (max-width: 699px) {
  .hero .ph { aspect-ratio: 4/3; }
  .hero .ph.noimg { aspect-ratio: 3/1; font-size: 56px; }
}
