:root {
  --green: #1f6b3a;
  --green-dark: #17512c;
  --leaf: #57b947;
  --leaf-soft: #eaf6e4;
  --sun: #f6c915;
  --sun-soft: #fff6cf;
  --bg: #faf8f1;
  --card: #ffffff;
  --ink: #1d2a21;
  --muted: #5f6f64;
  --line: #e3e1d6;
  --red: #b3261e;
  --red-soft: #fdecea;
  --blue-soft: #e8f1fb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 42, 33, 0.06), 0 4px 14px rgba(29, 42, 33, 0.06);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Telugu', 'Noto Sans Devanagari',
    'Noto Sans Kannada', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent;
}
body.has-tabs { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; }
a { color: var(--green); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

#main { max-width: 960px; margin: 0 auto; padding: 0 16px 32px; }
.center { text-align: center; }
.grow { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: 0.92rem; }
.link { background: none; border: 0; padding: 0; color: var(--green); font-weight: 600; text-decoration: underline; cursor: pointer; }

/* ---------- top bar and tabs ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px;
  background: rgba(250, 248, 241, 0.96);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--green); font-weight: 800; font-size: 1.15rem; letter-spacing: 0.02em; }
.top-right { display: flex; align-items: center; gap: 8px; }
.lang { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 10px; min-height: 40px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tab { flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: 0.78rem; font-weight: 600; text-align: center; }
.tab-ic { font-size: 1.35rem; line-height: 1; }
.tab.on { color: var(--green); background: var(--leaf-soft); }

/* ---------- buttons, inputs, chips ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer; text-align: center;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:active { background: var(--green-dark); }
.btn.whatsapp { background: #128c4b; border-color: #128c4b; color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: 0.92rem; border-radius: 10px; }
.btn.big { width: 100%; min-height: 56px; font-size: 1.08rem; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.busy { opacity: 0.6; }

.input {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
}
.input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--leaf-soft); }
.input.big { min-height: 56px; font-size: 1.2rem; }
.input.code { text-align: center; font-size: 1.8rem; letter-spacing: 0.5em; font-weight: 700; }
textarea.input { resize: vertical; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 8px 14px;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip-ic { font-size: 1.15rem; line-height: 1; }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.chips.static .chip { cursor: default; min-height: 36px; padding: 4px 12px; font-weight: 500; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 2px 16px 8px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.chips.tiles .chip { flex-direction: column; justify-content: center; min-height: 96px; border-radius: var(--radius); white-space: normal; text-align: center; padding: 10px 8px; }
.chips.tiles .chip-ic { font-size: 2rem; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: #efede3; color: var(--ink); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.badge.ok, .badge.green { background: var(--leaf-soft); color: var(--green-dark); }
.badge.info { background: var(--blue-soft); color: #1c4f82; }
.badge.muted { background: #ecebe6; color: var(--muted); }
.badge.bad { background: var(--red-soft); color: var(--red); }

.note { padding: 10px 14px; border-radius: 12px; background: var(--blue-soft); font-size: 0.94rem; }
.note.warn { background: var(--sun-soft); }
.note.ok { background: var(--leaf-soft); }

.toast {
  position: fixed; left: 50%; top: 68px; z-index: 50; transform: translate(-50%, -20px);
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 12px;
  background: var(--ink); color: #fff; font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }

/* ---------- landing page ---------- */
.hero {
  margin: 16px 0 28px; padding: 28px 20px;
  border-radius: 24px; color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, #3a9a4f 0%, transparent 60%), linear-gradient(160deg, #1f6b3a 0%, #17512c 100%);
}
.hero-in { max-width: 620px; margin: 0 auto; }
.eyebrow { display: inline-block; padding: 4px 12px; border-radius: 999px; background: rgba(255, 255, 255, 0.16); font-size: 0.88rem; font-weight: 600; }
.hero h1 { margin: 14px 0 10px; font-size: clamp(1.8rem, 6vw, 2.7rem); line-height: 1.15; }
.lead { font-size: 1.08rem; opacity: 0.94; }
.roles { display: grid; gap: 12px; margin: 22px 0 14px; }
.role {
  display: flex; align-items: center; gap: 14px;
  padding: 16px; border-radius: 18px;
  background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
}
.role.farmer { background: var(--sun); }
.role-ic { font-size: 2.2rem; line-height: 1; }
.role b { display: block; font-size: 1.2rem; }
.role small { display: block; color: #3b463f; font-size: 0.92rem; }
.role > span:nth-child(2) { flex: 1; }
.role-go, .option-go { font-size: 1.6rem; font-weight: 700; color: var(--green); line-height: 1; }
.free { font-weight: 600; }
.hero-langs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.hero-langs .chip { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.4); color: #fff; min-height: 40px; }
.hero-langs .chip.on { background: #fff; color: var(--green); border-color: #fff; }

.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 24px; padding: 18px; border-radius: 18px; background: var(--leaf-soft); }
.hello h1 { font-size: 1.25rem; }

.browse { margin-top: 20px; }
.filters { display: grid; gap: 10px; margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }

.card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.card-pic { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--leaf-soft); }
.card-pic img { width: 100%; height: 100%; object-fit: cover; }
.card-emoji { font-size: 3.4rem; line-height: 1; }
.card-emoji.big { font-size: 6rem; }
.card-flag { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: #fff; color: var(--green-dark); font-size: 0.72rem; font-weight: 700; box-shadow: var(--shadow); }
.card-body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.card-body h3 { font-size: 1.05rem; }
.card-price { color: var(--green); font-weight: 800; }
.card-meta, .card-place, .card-until { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.how { margin-top: 36px; }
.how-grid { display: grid; gap: 12px; }
.how-step { padding: 18px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.how-step p { color: var(--muted); }
.how-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 14px; background: var(--sun-soft); font-size: 1.7rem; }
.foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; text-align: center; }

.empty { display: grid; justify-items: center; gap: 12px; padding: 40px 16px; color: var(--muted); text-align: center; }
.empty.wide { grid-column: 1 / -1; }
.empty-ic { font-size: 3rem; }

/* ---------- product and farmer pages ---------- */
.detail, .page, .login, .wizard { max-width: 620px; margin: 0 auto; padding-top: 16px; display: grid; gap: 16px; }
.back-link { color: var(--muted); font-weight: 600; text-decoration: none; }
.detail-pic { display: grid; place-items: center; overflow: hidden; aspect-ratio: 4 / 3; border-radius: 20px; background: var(--leaf-soft); }
.detail-pic img { width: 100%; height: 100%; object-fit: cover; }
.detail-body { display: grid; gap: 14px; }
.detail-price { color: var(--green); font-size: 1.4rem; font-weight: 800; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }
.facts small { font-weight: 400; color: var(--muted); }
.card-box { padding: 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.note-text { padding: 12px 14px; border-left: 4px solid var(--leaf); background: var(--card); border-radius: 0 12px 12px 0; white-space: pre-wrap; }

.farmer-strip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.farmer-strip small { display: block; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--sun-soft); font-size: 1.6rem; flex: none; }
.avatar.big { width: 84px; height: 84px; font-size: 2.8rem; }
.profile-head { display: grid; justify-items: center; gap: 6px; text-align: center; }
.profile-head .badges { justify-content: center; }

.contact { display: grid; gap: 8px; padding: 16px; border-radius: var(--radius); background: var(--leaf-soft); }
.contact-name { font-weight: 700; text-align: center; }
.contact-phone { font-size: 1.7rem; font-weight: 800; text-align: center; letter-spacing: 0.04em; }
.contact-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.contact .link { text-align: center; }

/* ---------- login ---------- */
.login { padding-top: 32px; }
.login form { display: grid; gap: 14px; }
.login-ic { font-size: 3rem; text-align: center; }
.login h1 { text-align: center; }
.login .hint { text-align: center; }
.phone-row, .money { display: flex; align-items: center; gap: 8px; }
.prefix, .suffix { font-weight: 700; font-size: 1.2rem; color: var(--muted); white-space: nowrap; }
.suffix { font-size: 1rem; }

/* ---------- sign-up questions ---------- */
.wiz-top { display: flex; align-items: center; gap: 12px; }
.back { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); font-size: 1.3rem; cursor: pointer; }
.progress { flex: 1; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--leaf); transition: width 0.25s; }
.wiz-count { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.question { display: grid; gap: 14px; }
.question h1 { font-size: 1.6rem; }
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 12px 16px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: var(--card); text-align: left; cursor: pointer;
}
.option:active { background: var(--leaf-soft); }
.option.on { border-color: var(--green); background: var(--leaf-soft); }
.option.pinned { background: var(--sun-soft); border-color: #ecd97a; }
.option-ic { font-size: 1.9rem; line-height: 1; }
.option-text { flex: 1; }
.option-text b { display: block; font-size: 1.08rem; }
.option-text small { display: block; color: var(--muted); font-size: 0.9rem; }
.options.compact { gap: 6px; }
.options.compact .option { min-height: 52px; padding: 8px 14px; }
.or { text-align: center; color: var(--muted); font-weight: 600; }
.picked { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--leaf-soft); font-weight: 600; }
.group h2, .group h3 { margin: 6px 0 8px; font-size: 1rem; color: var(--muted); }
.sticky-foot { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding-top: 8px; }
body.has-tabs .sticky-foot { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
.sticky-foot .btn { box-shadow: 0 6px 18px rgba(23, 81, 44, 0.3); }
.done { display: grid; justify-items: center; gap: 14px; padding: 40px 0; text-align: center; }
.done-icon { font-size: 4.5rem; }

/* ---------- my products and the sell form ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rows { display: grid; gap: 12px; }
.row { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.row-main { display: flex; align-items: flex-start; gap: 12px; color: var(--ink); text-decoration: none; }
.row-main small { display: block; color: var(--muted); }
.row-main .views { color: var(--green); font-weight: 600; }
.row-pic { display: grid; place-items: center; overflow: hidden; width: 60px; height: 60px; flex: none; border-radius: 12px; background: var(--leaf-soft); font-size: 2rem; }
.row-pic img { width: 100%; height: 100%; object-fit: cover; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.form { gap: 22px; }
.field { display: grid; gap: 10px; }
.field > label { font-size: 1.08rem; font-weight: 700; }
.all-crops, .other-crop { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--card); border: 1.5px solid var(--line); }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dates label { display: grid; gap: 4px; color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.photo-preview { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.photo-preview img, .photo-empty { width: 88px; height: 88px; border-radius: 12px; object-fit: cover; }
.photo-empty { display: grid; place-items: center; background: var(--leaf-soft); font-size: 2rem; }

/* ---------- wider screens ---------- */
@media (min-width: 640px) {
  .roles { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 2fr 1fr; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .how-grid { grid-template-columns: repeat(3, 1fr); }
  .chips.tiles { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 48px 32px; }
  .tabs { justify-content: center; gap: 8px; }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
