:root {
  --bg: #f2f2f7; --card: #ffffff; --card2: #f2f2f7; --label: #000; --label2: rgba(60,60,67,.6); --label3: rgba(60,60,67,.3);
  --sep: rgba(60,60,67,.18); --fill: rgba(120,120,128,.12); --bar: rgba(249,249,249,.82);
  --green: #34c759; --green-d: #248a3d; --blue: #007aff; --orange: #ff9500; --red: #ff3b30; --gray: #8e8e93; --indigo: #5856d6;
  --r: 12px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg:#000; --card:#1c1c1e; --card2:#2c2c2e; --label:#fff; --label2:rgba(235,235,245,.6); --label3:rgba(235,235,245,.3);
    --sep:rgba(84,84,88,.6); --fill:rgba(118,118,128,.24); --bar:rgba(22,22,24,.8); --green:#30d158; --green-d:#30d158; --blue:#0a84ff; --orange:#ff9f0a; --red:#ff453a; --shadow:none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--label); }
body { font: 17px/1.29 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.41px; -webkit-font-smoothing: antialiased; min-height: 100vh; }
#app { max-width: 600px; margin: 0 auto; padding-bottom: calc(96px + var(--safe-b)); }
button { font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { display: block; }

/* nav bar */
.nav { position: sticky; top: 0; z-index: 10; height: calc(44px + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; justify-content: space-between; padding-left: 8px; padding-right: 16px;
  background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid transparent; transition: border-color .2s; }
.nav.scrolled { border-bottom-color: var(--sep); }
.nav .back { display: flex; align-items: center; gap: 2px; color: var(--blue); font-size: 17px; height: 44px; padding: 0 8px 0 0; }
.nav .ttl { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 600; opacity: 0; transition: opacity .2s; }
.nav.scrolled .ttl { opacity: 1; }
.nav .act { color: var(--blue); }
.large { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: .37px; margin: 4px 16px 2px; }
.sub { color: var(--label2); font-size: 15px; margin: 0 16px 16px; letter-spacing: -.24px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: -.08px;
  padding: 5px 10px; border-radius: 999px; background: rgba(255,149,0,.14); color: var(--orange); margin: 0 16px 16px; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* action tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px; }
.tile { background: var(--card); border-radius: 16px; padding: 14px; min-height: 112px; text-align: left; display: flex; flex-direction: column;
  justify-content: space-between; box-shadow: var(--shadow); transition: transform .12s ease, opacity .12s; }
.tile:active { transform: scale(.97); opacity: .85; }
.tile .ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.tile b { font-size: 17px; font-weight: 600; display: block; margin-top: 12px; }
.tile small { color: var(--label2); font-size: 13px; letter-spacing: -.08px; }

/* grouped lists */
.hdr { font-size: 13px; color: var(--label2); text-transform: uppercase; letter-spacing: -.08px; margin: 28px 32px 7px; }
.ftr { font-size: 13px; color: var(--label2); letter-spacing: -.08px; margin: 7px 32px 0; line-height: 18px; }
.group { background: var(--card); border-radius: var(--r); margin: 0 16px; overflow: hidden; }
.row { display: flex; align-items: center; min-height: 44px; padding: 0 16px; position: relative; gap: 12px; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: .5px; background: var(--sep); }
.row.ic-row + .row::before, .row.ic-row + .row.ic-row::before { left: 60px; }
.row label { flex: 0 0 auto; min-width: 96px; }
.row input, .row select { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--label); font: inherit;
  letter-spacing: inherit; text-align: right; height: 44px; padding: 0; }
.row input::placeholder { color: var(--label3); }
.row .unit { color: var(--label2); }
.row .val { margin-left: auto; color: var(--label2); }
.row.stack { flex-direction: column; align-items: stretch; gap: 0; padding: 10px 16px; }
.row.stack input { text-align: left; height: 28px; }
.row.stack label { font-size: 13px; color: var(--label2); min-width: 0; }
.ev { padding: 10px 16px; }
.ev .dot { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: 0 0 30px; }
.ev .t { flex: 1; min-width: 0; }
.ev .t b { font-weight: 400; display: block; }
.ev .t small { color: var(--label2); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev time { color: var(--label2); font-size: 15px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.badge.dry { background: rgba(255,149,0,.14); color: var(--orange); }
.badge.ok { background: rgba(52,199,89,.14); color: var(--green-d); }
.badge.err { background: rgba(255,59,48,.14); color: var(--red); }
.refs { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; }
.empty { text-align: center; color: var(--label2); padding: 28px 16px; font-size: 15px; }

/* segmented */
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; margin: 0 16px; }
.seg button { flex: 1; height: 32px; border-radius: 7px; font-size: 13px; font-weight: 500; }
.seg button.on { background: var(--card); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }

/* alert banner */
.banner { display: flex; gap: 12px; align-items: center; margin: 16px 16px 0; padding: 12px 14px; border-radius: var(--r); background: rgba(255,59,48,.1); color: var(--red); font-size: 15px; }
.banner.ok { background: rgba(52,199,89,.12); color: var(--green-d); }

/* primary button */
.cta { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 70%, transparent); z-index: 5; }
.cta-in { max-width: 568px; margin: 0 auto; }
.btn { width: 100%; height: 50px; border-radius: 14px; background: var(--green); color: #fff; font-size: 17px; font-weight: 600; transition: opacity .15s, transform .12s; }
.btn:active { transform: scale(.98); opacity: .85; }
.btn[disabled] { opacity: .45; }
.btn.plain { background: transparent; color: var(--blue); font-weight: 400; height: 44px; margin-top: 8px; }

/* tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; background: var(--bar); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep); padding-bottom: var(--safe-b); }
.tabbar-in { max-width: 600px; margin: 0 auto; display: flex; height: 49px; }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 500; color: var(--gray); letter-spacing: .1px; }
.tabbar button.on { color: var(--green-d); }

/* login */
.login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 0 120px; }
.logo { width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 22px; box-shadow: 0 10px 30px rgba(52,199,89,.35); }
.login h1 { text-align: center; font-size: 34px; font-weight: 700; letter-spacing: .37px; margin: 0; }
.login p { text-align: center; color: var(--label2); margin: 6px 32px 32px; font-size: 15px; }
.login .group { margin-bottom: 10px; }
.login .row input { text-align: left; }
.login .btnwrap { padding: 16px; }

/* toast sheet */
.toast { position: fixed; left: 50%; top: calc(16px + var(--safe-t)); transform: translate(-50%, -140%); z-index: 50; max-width: calc(100% - 32px);
  background: var(--card); color: var(--label); border-radius: 18px; padding: 12px 18px 12px 14px; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.18); font-size: 15px; transition: transform .35s cubic-bezier(.2,.9,.3,1.2); }
.toast.show { transform: translate(-50%, 0); }
.toast .ti { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: 0 0 28px; }
.toast b { display: block; font-weight: 600; }
.toast small { display: block; color: var(--label2); font-size: 13px; }

.fade { animation: fade .28s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.toast[hidden] { display: none; }
.tile { justify-content: flex-start; gap: 0; }
.tile b { margin-top: 14px; }
.admin { display: inline-flex; align-items: center; gap: 4px; color: var(--indigo); font-weight: 600; }
.admin svg { display: inline-block; }
button.row { width: 100%; text-align: left; }
.row .chev { margin-left: auto; color: var(--label3); }
.site:active { background: var(--fill); }

/* ===== Goodness Gardens brand layer (light glass + fresh green) ===== */
:root { --gg: #2E9E4F; --gg-d: #1F7A3A; --gg-soft: rgba(46,158,79,.12); --cta: var(--gg); --cta-ink: #fff; }
@media (prefers-color-scheme: dark) { :root { --gg: #34C759; --gg-d: #30D158; --gg-soft: rgba(52,199,89,.18); } }
.nav { background: var(--bar); color: var(--label); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep) !important; box-shadow: none; }
.nav .back, .nav .act { color: var(--gg-d); }
.nav .act { font-size: 15px; font-weight: 600; background: var(--gg-soft); padding: 6px 12px; border-radius: 999px; }
.nav .ttl { color: var(--label); }
.nav .brand { height: 30px; width: auto; display: block; margin-left: 8px; }
.nav.home-nav .ttl { opacity: 0 !important; }
.large { margin-top: 18px; }
.btn { background: var(--cta); color: var(--cta-ink); box-shadow: 0 6px 18px rgba(46,158,79,.28); }
.tabbar button.on { color: var(--gg-d); }
.link { color: var(--gg-d) !important; }

/* login hero */
.login { padding: 0 0 120px; justify-content: flex-start; }
.hero { background: linear-gradient(180deg, #ffffff 0%, #EAF7EE 100%);
  padding: calc(56px + var(--safe-t)) 24px 40px; border-radius: 0 0 32px 32px; text-align: center; margin-bottom: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06); }
@media (prefers-color-scheme: dark) { .hero { background: linear-gradient(180deg, #1c1c1e 0%, #10261a 100%); box-shadow: none; } }
.hero img { width: min(78%, 300px); height: auto; }
.hero .app-name { display: inline-flex; align-items: center; gap: 8px; margin-top: 18px; padding: 5px 14px 5px 5px; border-radius: 999px;
  background: var(--gg-soft); color: var(--gg-d); font-weight: 600; font-size: 15px; letter-spacing: .2px; }
.hero .app-name i { width: 8px; height: 8px; border-radius: 50%; background: var(--gg); box-shadow: 0 0 0 3px rgba(46,158,79,.25); }
.hero p { color: var(--label2); margin: 10px 0 0; font-size: 14px; }
.hero .app-name img { width: 28px; height: 28px; border-radius: 7px; }
.row select { text-align: right; appearance: none; -webkit-appearance: none; text-overflow: ellipsis; }
.ftr.err { color: var(--red); }
.row .act { border: 0; background: transparent; color: var(--blue); font: inherit; font-weight: 600; padding: 0; }
.scan-ov { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px; gap: 12px; }
.scan-ov video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-ov .btn { position: relative; }
/* Inventory */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; background: var(--fill, rgba(120,120,128,.14)); color: var(--label, #000); }
.chip.on { background: var(--gg); color: #fff; }
.pthumb { flex: 0 0 auto; border-radius: 8px; object-fit: contain; background: #fff; border: 1px solid rgba(0,0,0,.08); }
.pthumb.none { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: var(--gg); border: 0; }
.row.inv .t { min-width: 0; }
.row.inv .t b, .row.inv .t small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.row .qty { margin-left: auto; text-align: right; flex: 0 0 auto; padding-left: 8px; }
.row .qty b { display: block; font-variant-numeric: tabular-nums; }
.row .qty small { display: block; color: var(--label2); font-size: 12px; }
.row label.me { font-weight: 700; }
.row .val small { color: var(--label2); font-size: 12px; }
.phero { margin: 4px 16px 8px; border-radius: 14px; background: #fff; display: flex; justify-content: center; padding: 12px; }
.phero img { max-width: 100%; max-height: 260px; object-fit: contain; }
.link { border: 0; background: none; color: var(--blue); font: inherit; padding: 0; text-decoration: underline; cursor: pointer; }
#q { text-align: left; }
.row.inv .t b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.row .act { display: inline-flex; align-items: center; gap: 4px; color: var(--gg-d); white-space: nowrap; }
.ftr.err, #calc.err { color: var(--red); }

.seg { display: flex; margin: 0 16px 14px; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; padding: 7px 0; border-radius: 7px; font-size: 15px; font-weight: 600; color: var(--label); }
.seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.inv .t small.lots { color: var(--gg-d); font-variant-numeric: tabular-nums; white-space: normal; overflow: visible; text-overflow: clip; word-break: break-word; }

.nav .rf { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 999px; color: var(--gg-d); background: var(--gg-soft); }
.nav .rf.spin svg { animation: rfspin .8s linear infinite; }
@keyframes rfspin { to { transform: rotate(360deg); } }
.nav .navr { display: flex; align-items: center; gap: 8px; }
.val.err { color: var(--red); }

/* label after a Seed / Stick / Harvest */
.done { text-align: center; padding: 8px 0 150px; }
.done .ok-ic { width: 64px; height: 64px; margin: 18px auto 4px; border-radius: 50%; background: var(--green); color: #fff; display: flex; align-items: center; justify-content: center; }
.done .large, .done .sub { text-align: center; }
.done .lotbox { margin: 18px 16px; padding: 14px; border-radius: var(--r); background: var(--card); box-shadow: var(--shadow); }
.done .lotbox small { display: block; color: var(--label2); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.done .lotbox b { font-size: 28px; letter-spacing: .02em; word-break: break-all; }
.done .group { text-align: left; }
.done .banner { justify-content: center; background: var(--fill); color: var(--label2); }
.step { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.step button { width: 36px; height: 36px; border-radius: 10px; background: var(--fill); font-size: 20px; font-weight: 600; color: var(--label); }
.step input { width: 48px; text-align: center; font-size: 17px; }
.prt { width: 36px; height: 36px; margin-left: 8px; border-radius: 10px; background: var(--fill); color: var(--label); display: flex; align-items: center; justify-content: center; flex: none; }
.prt[disabled] { opacity: .45; }
.row .act { margin-left: auto; flex: none; font-size: 14px; font-weight: 600; color: var(--red); background: rgba(255,59,48,.1); padding: 6px 12px; border-radius: 999px; }

/* lot picker results */
.lotres { margin-top: 8px; }
.lotres[hidden] { display: none; }
.lotopt { width: 100%; text-align: left; display: flex; align-items: center; gap: 10px; }
.lotopt .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lotopt .t b { font-size: 18px; letter-spacing: .02em; }
.lotopt .t small { color: var(--label2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lotopt .qty { text-align: right; display: flex; flex-direction: column; }
.lotopt .qty small { color: var(--label2); font-size: 12px; }
.empty.err { color: var(--red); }
.scan-hint { position: absolute; left: 16px; right: 16px; top: max(24px, env(safe-area-inset-top)); text-align: center; color: #fff; font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scan-btns { position: absolute; left: 16px; right: 16px; bottom: max(24px, env(safe-area-inset-bottom)); display: flex; gap: 12px; }
.scan-btns .btn { flex: 1; }
