:root{
  --bg: #F3F7EC;
  --surface: #E8F0DD;
  --surface-2: #DCE8C9;
  --ink: #1F2A17;
  --ink-soft: #5B6B4F;
  --accent: #3F6B35;
  --accent-dark: #2C4A24;
  --accent-light: #E3EEDB;
  --gold: #B08D3F;
  --gold-light: #F3EAD0;
  --terracotta: #B5651D;
  --terracotta-light: #F2E0CF;
  --line: #D7E2C8;
  --white: #FFFFF9;
  --radius-s: 6px;
  --radius-m: 13px;
  --radius-l: 22px;
  --shadow: 0 14px 34px rgba(31,42,23,0.14);
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; overflow-x:hidden; width:100%; }
body{
  background: var(--bg);
  color: var(--ink);
  font-family: 'Work Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1,h2,h3,.serif { font-family: 'Fraunces', serif; margin:0; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 96px;
}

.screen { display:none; }
.screen.active { display:block; }

/* ---------- Top bar ---------- */
.topbar { padding: 22px 18px 10px; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; }
.topbar h1 { font-size: 24px; color: var(--accent-dark); }
.topbar .sub { width:100%; margin-top:4px; font-size:13px; color: var(--ink-soft); }
.back-btn { background:none; border:none; color: var(--accent); font-weight:600; font-size:15px; padding:0; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom:0; left:0; right:0; z-index:45;
  display:flex; max-width:480px; margin:0 auto;
  background: var(--white); border-top:1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(31,42,23,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-btn { flex:1; background:none; border:none; padding:10px 4px 9px; display:flex; flex-direction:column; align-items:center; gap:4px; color: var(--ink-soft); }
.tab-btn svg { width:21px; height:21px; }
.tab-btn span { font-size:11px; font-weight:600; }
.tab-btn.active { color: var(--accent); }

/* ---------- Lists / cards ---------- */
.list-wrap { padding: 4px 16px 10px; }

.plant-card {
  display:flex; gap:12px; align-items:center;
  background: var(--white); border:1px solid var(--line); border-radius: var(--radius-m);
  padding: 12px; margin-bottom: 10px;
}
.plant-card img.thumb, .plant-card .thumb-fallback {
  width:56px; height:56px; border-radius: var(--radius-s); object-fit:cover; background: var(--surface-2);
  display:flex; align-items:center; justify-content:center; font-size:24px; flex-shrink:0;
}
.plant-card-main { flex:1; min-width:0; }
.plant-card-name { font-weight:600; font-size:15.5px; color: var(--ink); margin-bottom:2px; }
.plant-card-meta { font-size:12.5px; color: var(--ink-soft); }
.plant-card-del { background:none; border:none; color:#9B3A3A; font-size:18px; padding:4px 6px; }

.cal-task-card {
  display:flex; gap:12px; align-items:flex-start;
  background: var(--white); border:1px solid var(--line); border-radius: var(--radius-m);
  padding: 12px; margin-bottom: 10px;
}
.cal-task-card.done { opacity: .55; }
.cal-check {
  width:26px; height:26px; border-radius:50%; border:2px solid var(--accent); flex-shrink:0;
  display:flex; align-items:center; justify-content:center; background:var(--white); margin-top:2px;
}
.cal-check.checked { background: var(--accent); color:#fff; }
.cal-task-main { flex:1; min-width:0; }
.cal-task-title { font-weight:600; font-size:14.5px; color:var(--ink); }
.cal-task-title.done-text { text-decoration: line-through; }
.cal-task-plant { font-size:12.5px; color: var(--accent); font-weight:600; margin-top:1px; }
.cal-task-desc { font-size:12.5px; color: var(--ink-soft); margin-top:3px; }
.task-chip {
  display:inline-block; font-size:10.5px; font-weight:700; text-transform:uppercase; letter-spacing:.02em;
  padding:2px 7px; border-radius:20px; margin-top:4px;
  background: var(--accent-light); color: var(--accent-dark);
}
.task-chip.fertilize { background: var(--gold-light); color:#7A5E1E; }
.task-chip.prune { background: var(--terracotta-light); color: var(--terracotta); }

/* ---------- Library ---------- */
.species-card { background: var(--white); border:1px solid var(--line); border-radius: var(--radius-m); padding:14px; margin-bottom:10px; display:flex; gap:12px; align-items:center; }
.species-icon { font-size:26px; width:44px; height:44px; border-radius:50%; background: var(--surface); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.species-main { flex:1; min-width:0; }
.species-name { font-weight:600; font-size:15px; }
.species-sub { font-size:12.5px; color: var(--ink-soft); }

.section-heading { font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color: var(--accent-dark); margin: 18px 0 8px; }
.task-row, .dd-row { background: var(--white); border:1px solid var(--line); border-radius: var(--radius-s); padding:10px 12px; margin-bottom:8px; display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.task-row-main, .dd-row-main { flex:1; min-width:0; font-size:13.5px; }
.task-row-sub { font-size:12px; color:var(--ink-soft); margin-top:2px; }
.row-del { background:none; border:none; color:#9B3A3A; font-size:16px; flex-shrink:0; }

/* ---------- Forms ---------- */
.form-wrap { padding: 8px 16px 24px; display:flex; flex-direction:column; }
.field-label { font-size:12.5px; font-weight:600; color: var(--ink-soft); margin: 14px 0 5px; }
input[type=text], input[type=date], input[type=number], textarea, select {
  background: var(--white); border:1px solid var(--line); border-radius: var(--radius-s);
  padding: 11px 12px; font-size:14.5px; color: var(--ink); width:100%;
}
textarea { resize: vertical; }
.btn-primary {
  margin-top: 20px; background: var(--accent); color:#fff; border:none; border-radius: var(--radius-m);
  padding: 13px; font-size:15px; font-weight:700;
}
.btn-secondary {
  background: var(--accent-light); color: var(--accent-dark); border:1px solid var(--accent);
  border-radius: var(--radius-m); padding: 11px; font-size:14px; font-weight:700; width:100%;
}
.btn-small { background: var(--surface-2); color: var(--accent-dark); border:none; border-radius: var(--radius-s); padding:8px 10px; font-size:13px; font-weight:600; }

.photo-pick {
  position:relative; width:100%; height:140px; border-radius: var(--radius-m); background: var(--surface);
  border: 1.5px dashed var(--line); display:flex; align-items:center; justify-content:center; overflow:hidden;
}
.photo-pick img { width:100%; height:100%; object-fit:cover; }
.photo-pick span { color: var(--ink-soft); font-size:13.5px; }
.photo-pick input[type=file] { position:absolute; inset:0; opacity:0; cursor:pointer; }

/* ---------- Dos/Donts ---------- */
.dd-do { color: var(--accent-dark); }
.dd-dont { color: var(--terracotta); }

/* ---------- Misc ---------- */
.empty-state { text-align:center; padding: 60px 30px; color: var(--ink-soft); }
.empty-emoji { font-size:40px; margin-bottom: 10px; }
.cal-nav { display:flex; align-items:center; gap:10px; padding: 4px 16px 12px; }
.cal-nav input[type=date] { flex:1; }
.cal-arrow { background: var(--white); border:1px solid var(--line); border-radius: var(--radius-s); width:38px; height:38px; font-size:18px; color: var(--accent); }
