/* main.css — DirtSide Rebuild design system.
   Fresh visual design per the brief (not a carry-forward of the old app's
   forest-green/white "Clean & Bright" theme). Palette: warm cream/parchment
   background with moss + terracotta accents — a garden-notebook feel rather
   than a corporate-green one. Mobile-first; this app is used one-handed in
   a backyard, often in direct sun (see --contrast-boost for a future
   sunlight-mode toggle, deferred — see STATUS.md). */

:root {
  --bg: #FAF6EE;
  --bg-elevated: #FFFFFF;
  --ink: #2B2A25;
  --ink-soft: #6B6759;
  --line: #E5DDC8;
  --moss: #4A6741;
  --moss-dark: #384F32;
  --terracotta: #C1662F;
  --terracotta-dark: #A24F20;
  --amber: #C68A1E;

  --status-thriving: #4A8B3B;
  --status-healthy: #6FA85C;
  --status-monitor: #D9A72C;
  --status-declining: #C1512F;
  --status-unidentified: #8B6DAE;
  --status-empty: #B9B2A0;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 3px rgba(43, 42, 37, 0.08), 0 1px 2px rgba(43, 42, 37, 0.06);
  --shadow-lift: 0 8px 24px rgba(43, 42, 37, 0.14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button { font-family: inherit; }

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px calc(10px + env(safe-area-inset-top, 0px));
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar__back {
  background: none; border: none; font-size: 20px; color: var(--moss-dark);
  cursor: pointer; padding: 4px 6px; line-height: 1; visibility: hidden;
}
.topbar__back.visible { visibility: visible; }
.topbar__title { font-family: var(--font-serif); font-size: 19px; font-weight: 700; flex: 1; }
.topbar__sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.topbar__badge {
  font-size: 11px; font-weight: 700; background: var(--terracotta);
  color: #fff; padding: 3px 8px; border-radius: 99px;
}

/* ── Screen stack ────────────────────────────────────────────────────── */
.screens { flex: 1; position: relative; overflow: hidden; }
.screen {
  position: absolute; inset: 0; overflow-y: auto;
  padding: 14px 14px calc(90px + var(--safe-bottom));
  display: none;
}
.screen.active { display: block; }

/* ── Bottom nav ──────────────────────────────────────────────────────── */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--bg-elevated);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.bottomnav__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: none; padding: 9px 4px 8px; cursor: pointer;
  color: var(--ink-soft); font-size: 11px;
}
.bottomnav__btn .ic { font-size: 20px; }
.bottomnav__btn.active { color: var(--moss); font-weight: 700; }

/* ── Cards & grids ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-elevated); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px;
}
.zone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.zone-card {
  background: var(--bg-elevated); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; text-align: left; border: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px; min-height: 92px;
}
.zone-card__name { font-weight: 700; font-size: 15px; }
.zone-card__meta { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot--thriving, .dot--healthy { background: var(--status-thriving); }
.dot--monitor { background: var(--status-monitor); }
.dot--declining { background: var(--status-declining); }
.dot--unidentified { background: var(--status-unidentified); }
.dot--empty { background: var(--status-empty); }
.pill {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--ink-soft);
}
.pill--needsid { background: #EFE7F7; color: var(--status-unidentified); }
.pill--tasks { background: #FBEFE2; color: var(--terracotta-dark); }

.section-title { font-family: var(--font-serif); font-size: 17px; font-weight: 700; margin: 18px 0 8px; }
.subtle { color: var(--ink-soft); font-size: 13px; }

/* ── Plant grid (position codes) ─────────────────────────────────────── */
.subarea-block { margin-bottom: 16px; }
.subarea-block__title { font-weight: 700; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; letter-spacing: .02em; }
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.plant-cell {
  background: var(--bg-elevated); border-radius: var(--radius-sm); box-shadow: var(--shadow);
  border: none; padding: 8px; cursor: pointer; text-align: left; position: relative;
  display: flex; flex-direction: column; gap: 4px; min-height: 96px;
}
.plant-cell__photo {
  width: 100%; aspect-ratio: 1; border-radius: 7px; object-fit: cover; background: var(--line);
}
.plant-cell__photo-ph {
  width: 100%; aspect-ratio: 1; border-radius: 7px; background: var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--ink-soft);
}
.plant-cell__code { font-size: 11px; font-weight: 700; color: var(--moss-dark); }
.plant-cell__name { font-size: 11px; color: var(--ink-soft); line-height: 1.2; }
.plant-cell__dot { position: absolute; top: 6px; right: 6px; box-shadow: 0 0 0 2px #fff; }

/* ── Plant detail card ───────────────────────────────────────────────── */
.pd-photo { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--radius); background: var(--line); }
.pd-photo-ph {
  width: 100%; aspect-ratio: 4/3; border-radius: var(--radius); background: var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 40px; color: var(--ink-soft);
}
.pd-name { font-family: var(--font-serif); font-size: 22px; font-weight: 700; margin-top: 12px; }
.pd-sub { color: var(--ink-soft); font-size: 13px; margin-top: 2px; }
.pd-status-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.pd-note { font-size: 14px; line-height: 1.4; background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.pd-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn {
  border: none; border-radius: 99px; padding: 10px 16px; font-weight: 700; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn--primary { background: var(--moss); color: #fff; }
.btn--secondary { background: var(--bg-elevated); color: var(--moss-dark); border: 1px solid var(--line); }
.btn--terracotta { background: var(--terracotta); color: #fff; }
.btn--block { width: 100%; justify-content: center; padding: 13px; }
.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Forms ────────────────────────────────────────────────────────────── */
label.field { display: block; margin-bottom: 12px; }
label.field .field__label { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; display: block; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; background: var(--bg-elevated); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; }
.status-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.status-chip {
  border: 1px solid var(--line); background: var(--bg-elevated); border-radius: 99px;
  padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.status-chip.selected { border-color: transparent; color: #fff; }
.status-chip.selected.thriving, .status-chip.selected.healthy { background: var(--status-thriving); }
.status-chip.selected.monitor { background: var(--status-monitor); color: var(--ink); }
.status-chip.selected.declining { background: var(--status-declining); }
.status-chip.selected.unidentified { background: var(--status-unidentified); }
.status-chip.selected.empty { background: var(--status-empty); color: var(--ink); }

/* ── Task list ────────────────────────────────────────────────────────── */
.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: none; }
.task-check {
  width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--moss); flex-shrink: 0;
  background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.task-check.done { background: var(--moss); color: #fff; font-size: 13px; }
.task-text { font-size: 14px; flex: 1; }
.task-text.done { text-decoration: line-through; color: var(--ink-soft); }
.task-add-row { display: flex; gap: 8px; margin-top: 12px; }
.task-add-row input { flex: 1; }

/* ── Dictation ────────────────────────────────────────────────────────── */
.dictation-mic {
  width: 100%; padding: 22px; border-radius: var(--radius); border: 2px dashed var(--moss);
  background: #F1F5EE; text-align: center; cursor: pointer; margin-bottom: 12px;
}
.dictation-mic.listening { border-style: solid; background: #FBEFE2; border-color: var(--terracotta); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(193,102,47,.25);} 50% { box-shadow: 0 0 0 10px rgba(193,102,47,0);} }
.dictation-mic__ic { font-size: 30px; }
.dictation-mic__label { font-size: 13px; font-weight: 700; color: var(--moss-dark); margin-top: 6px; }
.proposal-block { border-left: 3px solid var(--moss); padding: 10px 12px; background: var(--bg-elevated); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 10px; box-shadow: var(--shadow); }
.proposal-block__head { font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: space-between; }
.proposal-block__body { font-size: 13px; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; }
.proposal-block--task { border-left-color: var(--terracotta); }
.proposal-block--correction { border-left-color: var(--amber); }
.confidence-low { color: var(--status-declining); font-weight: 700; }

/* ── Session log ──────────────────────────────────────────────────────── */
.session-entry { padding: 12px 0; border-bottom: 1px solid var(--line); }
.session-entry:last-child { border-bottom: none; }
.session-entry__date { font-weight: 700; font-size: 13px; }
.session-entry__zones { font-size: 11px; color: var(--ink-soft); margin: 2px 0 6px; }
.session-entry__text { font-size: 13px; line-height: 1.4; white-space: pre-wrap; }

/* ── Misc ─────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-soft); }
.empty-state__ic { font-size: 34px; margin-bottom: 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(78px + var(--safe-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 13px;
  z-index: 100; box-shadow: var(--shadow-lift); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.offline-banner {
  background: var(--amber); color: #3a2b06; font-size: 12px; font-weight: 700;
  text-align: center; padding: 6px; display: none;
}
.offline-banner.show { display: block; }
a { color: var(--moss-dark); }
