/* Satokori marketplace artifacts — OfferUp density, farm palette.
   Price and produce first. Hairlines. One accent. No decoration. */

:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --ink: #111111;
  --muted: #6b6458;
  --line: #e6e0d4;
  --acc: #1f7a3a;
  --acc-2: #165a2b;
  --on-acc: #fff;
  --copper: #b86132;
  --gold: #c49212;
  --paper: #ece6d8;
  --warn: #fff6d6;
  --pill: #eef6ef;
  --flag: rgba(255,255,255,.92);
  --lift: rgba(255,255,255,.88);
  --chip-on: var(--ink);
  --chip-on-ink: #fff;
  --sab: env(safe-area-inset-bottom, 0px);
  --sat: env(safe-area-inset-top, 0px);
  /* Buttons sit above the iPhone home indicator; extra pad is the swipe zone. */
  --tab-pad: max(12px, var(--sab));
  --tabh: calc(56px + var(--tab-pad));
  --hero-dairy: #efe4c4;
  --hero-greens: #c5d9b8;
  --hero-berries: #e8c4c8;
  --hero-eggs: #f3e0a8;
  --hero-root: #e6c9a0;
  --hero-vegetable: #d4e2c4;
  --hero-preserve: #ead7b0;
  --hero-feed: #d7cbb6;
  --hero-produce: #d9e4d2;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0e1511;
  --surface: #1a2420;
  --ink: #f3efe6;
  --muted: #a39886;
  --line: #2e3b34;
  --acc: #4caf68;
  --acc-2: #2f7a44;
  --on-acc: #07140c;
  --paper: #121a16;
  --warn: #3a3420;
  --pill: #243328;
  --flag: rgba(14,21,17,.88);
  --lift: rgba(14,21,17,.82);
  --chip-on: #4caf68;
  --chip-on-ink: #07140c;
  --hero-dairy: #3a3424;
  --hero-greens: #243328;
  --hero-berries: #3a2428;
  --hero-eggs: #3a3420;
  --hero-root: #3a2e20;
  --hero-vegetable: #283428;
  --hero-preserve: #3a3224;
  --hero-feed: #322c24;
  --hero-produce: #243028;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  font-size: 15px; line-height: 1.25;
  min-height: 100vh; padding-bottom: var(--tabh);
  -webkit-font-smoothing: antialiased;
}
html.sheet-open, html.sheet-open body {
  overflow: hidden !important;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
html.sheet-open::-webkit-scrollbar,
html.sheet-open body::-webkit-scrollbar,
html.sheet-open *::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}
html.sheet-open body {
  position: fixed;
  inset: 0;
  width: 100%;
}
html.sheet-open main,
html.sheet-open #view-browse,
html.sheet-open #catalog {
  overflow: hidden !important;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--ink); }
a { color: var(--acc); text-decoration: none; }
.hidden { display: none !important; }
html[data-signed-in="1"] #view-home { display: none !important; }

.home { max-width: 400px; margin: 0 auto; padding: 28px 12px 16px; }
.home h1 { font-size: 32px; font-weight: 800; letter-spacing: -.04em; }
.home .lede { font-size: 18px; font-weight: 600; margin: 10px 0 6px; }
.home .btn { margin-top: 10px; }

#topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  padding: calc(8px + var(--sat)) 10px 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.icon-btn {
  flex: none; width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.icon-btn svg {
  width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.brand {
  flex: none;
  display: flex; align-items: center; gap: 8px;
  font-size: 17px; font-weight: 800; letter-spacing: -.03em;
  color: var(--ink); white-space: nowrap;
}
.brand img {
  width: 28px; height: 28px; border-radius: 7px; object-fit: cover; display: block;
}
.searchf {
  flex: 1; display: flex; align-items: center; min-height: 36px;
  background: var(--bg); border-radius: 8px; padding: 0 10px;
}
.searchf input { flex: 1; border: 0; background: transparent; min-height: 36px; outline: none; }
#page-title { font-size: 17px; font-weight: 700; flex: 1; }
.lang { display: flex; flex: none; background: var(--bg); border-radius: 8px; padding: 2px; }
.lang button { min-height: 28px; padding: 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); border-radius: 6px; }
.lang button.on { background: var(--ink); color: var(--bg); }

.chips {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px 6px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; padding: 6px 12px; border-radius: 999px;
  background: var(--bg); font-size: 13px; font-weight: 600; color: var(--ink);
}
.chips button.on { background: var(--chip-on); color: var(--chip-on-ink); }

main { max-width: 720px; margin: 0 auto; padding: 8px 8px 16px; }
.grid { display: grid; gap: 8px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  display: flex; flex-direction: column; text-align: left;
  background: var(--surface); border-radius: 8px; overflow: hidden;
  position: relative;
}
.tile:active { opacity: .92; }
.tile-hero {
  aspect-ratio: 1; display: flex; align-items: flex-end;
  padding: 0; color: #fff;
  font-size: 18px; font-weight: 750; letter-spacing: -.03em; line-height: 1.05;
  position: relative; overflow: hidden;
  background: var(--paper);
}
.tile-hero img, .tile-hero .produce-icon {
  position: absolute; inset: 0; width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  object-fit: contain; object-position: center;
  padding: 10%; display: block; z-index: 0;
}
.tile-hero span {
  position: relative; z-index: 1; width: 100%;
  padding: 28px 10px 10px;
  background: linear-gradient(transparent, rgba(17,24,16,.78));
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tile-body { padding: 8px 8px 10px; }
.tile-price { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.tile-title { font-size: 13px; font-weight: 600; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta { font-size: 11px; color: var(--muted); margin-top: 3px; }
.tile.sold-out .tile-hero { filter: grayscale(.4); opacity: .8; }
.tile.featured { box-shadow: 0 0 0 2px var(--gold); }
.tile-flag {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  padding: 3px 7px; border-radius: 99px;
  background: var(--flag); font-size: 10px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink);
}
.tile-flag.gold { background: var(--gold); color: #fff; }
.tile-flag.live { background: var(--acc); color: var(--on-acc); }
.tile-flag.demo { color: var(--copper); }
.tile-flag.drop { background: #17241c; color: #f6f3ec; }
.tile-flag.lock, .tag .lock-ico { display: inline-flex; align-items: center; gap: 4px; }
.lock-ico { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; vertical-align: -2px; }
.privacy-row { align-items: center; gap: 12px; }
.privacy-row input { width: auto; min-height: 22px; }
.farm-item { cursor: pointer; }
.admin-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.admin-tile { background: var(--surface); border-radius: 10px; padding: 12px; }
.admin-tile .l { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.admin-tile .v { font-size: 22px; font-weight: 800; margin-top: 4px; }
.farm-row { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.farm-row:last-child { border-bottom: 0; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 99px; background: var(--bg); font-size: 11px; font-weight: 700; margin-right: 4px; }
.tag.acc { background: var(--acc); color: #fff; }
.tag.gold { background: var(--gold); color: #fff; }
.tag.copper { background: var(--copper); color: #fff; }
.fav {
  position: absolute; top: 6px; right: 6px; z-index: 3; width: 32px; height: 32px;
  border-radius: 99px; background: var(--lift);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--muted);
}
.fav.on { color: var(--copper); background: var(--surface); box-shadow: 0 0 0 2px var(--copper); }

.card { background: var(--surface); border-radius: 10px; padding: 12px; }
.card h3 { font-size: 16px; font-weight: 700; }
.meta { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.price { font-weight: 800; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 10px 14px; border-radius: 8px;
  font-size: 15px; font-weight: 700;
  background: var(--bg); color: var(--ink);
}
.btn.primary { background: var(--acc); color: var(--on-acc); }
.btn.ghost { background: transparent; color: var(--acc); border: 1px solid var(--acc); }
.btn.copper { background: var(--copper); color: #fff; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.row, .row3 { display: grid; gap: 8px; }
.row { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) { .row, .row3 { grid-template-columns: 1fr; } }

label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; }
input, select, textarea {
  width: 100%; padding: 10px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); min-height: 44px; margin-top: 3px;
}
.leaflet-map { height: 220px; border-radius: 8px; margin: 6px 0 10px; }
#farms-map.leaflet-map {
  height: 50vh;
  height: 50dvh;
  min-height: 280px;
  margin: 0 0 10px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabh) + 10px);
  transform: translateX(-50%); z-index: 70;
  background: var(--ink); color: #fff; padding: 8px 14px;
  border-radius: 999px; max-width: 90%; font-size: 14px;
}

.order-alert { background: var(--warn); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.order-alert h2 { font-size: 16px; font-weight: 700; }
.farmer-reply { background: var(--warn); border-radius: 8px; padding: 10px; margin: 8px 0; }
.farmer-reply .kicker { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--copper); font-weight: 700; }
.farmer-reply .said { font-size: 20px; font-weight: 750; margin-top: 2px; }
.card.has-reply { outline: 2px solid var(--gold); }
.basket-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.role-pill { display: inline-block; background: var(--pill); color: var(--acc); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; }

.seg { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; }
.seg button { flex: 1; min-height: 34px; border-radius: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); }

#sheet {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 80; background: rgba(0,0,0,.4);
  display: flex; align-items: stretch; justify-content: center;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
#sheet .sheet-card {
  position: relative;
  width: min(720px, 100%); height: 100%; max-height: 100%; min-height: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  padding-bottom: var(--tab-pad);
}
#sheet-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
  width: 100%;
}
.sheet-x {
  position: absolute; top: calc(8px + var(--sat)); right: 10px; z-index: 6;
  width: 36px; height: 36px; border-radius: 99px;
  background: var(--lift); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.sheet-x svg {
  width: 18px; height: 18px; stroke: currentColor; fill: none;
  stroke-width: 2.2; stroke-linecap: round;
}
.detail-hero {
  flex: 0 0 auto; aspect-ratio: 1; max-height: min(28vw, 150px); min-height: 96px;
  display: flex; align-items: flex-end; padding: 0;
  font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05;
  position: relative; overflow: hidden; color: #fff; background: var(--paper);
}
.detail-hero img, .detail-hero .produce-icon {
  position: absolute; inset: 0; width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
  object-fit: contain; object-position: center; padding: 8%; display: block;
}
.detail-hero span {
  position: relative; z-index: 1; width: 100%;
  padding: 36px 16px 14px;
  background: linear-gradient(transparent, rgba(17,24,16,.78));
}
.detail-body {
  flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.detail-body::-webkit-scrollbar,
.detail-body::-webkit-scrollbar-thumb,
.detail-body::-webkit-scrollbar-track {
  width: 0; height: 0; display: none; background: transparent;
}
.detail-price { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.detail-title { font-size: 20px; font-weight: 700; margin-top: 4px; }
.detail-bar {
  flex: 0 0 auto; display: flex; gap: 8px;
  padding: 10px 12px;
  background: var(--surface); border-top: 1px solid var(--line);
}
.detail-bar .btn { flex: 1; }
.ask-channels {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin: 12px 0 8px;
}
.ask-channels .btn { min-height: 56px; font-size: 17px; font-weight: 800; }
.ask-channels .btn:disabled { opacity: .45; }
.reko-week-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.reko-week-row:first-child { border-top: 0; padding-top: 0; }
.reko-week-row .grow { flex: 1 1 160px; }
.reko-week-row .btn { min-height: 44px; }

.item-pick { position: relative; }
.item-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% - 2px); z-index: 25;
  max-height: 240px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 28px rgba(17, 24, 16, .16);
  scrollbar-width: none;
}
.item-suggest::-webkit-scrollbar { display: none; }
.item-suggest button {
  display: block; width: 100%; text-align: left;
  min-height: 44px; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 600;
  background: var(--surface); color: var(--ink);
}
.item-suggest button:last-child { border-bottom: 0; }
.item-suggest .item-new { color: var(--acc); font-weight: 700; }

.listing-row { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: start; }
.listing-row .produce-icon {
  width: 56px; height: 56px; object-fit: contain; padding: 4px; border-radius: 8px;
  grid-column: 1; grid-row: 1 / -1; background: var(--paper);
}
.listing-row > :not(.produce-icon) { grid-column: 2; }

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: flex-start;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px 0 var(--tab-pad);
  touch-action: manipulation;
}
#tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 10px; font-weight: 600; position: relative;
  min-height: 44px; padding: 4px 2px 6px;
  touch-action: manipulation;
}
#tabbar button span {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#tabbar button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabbar button .mark {
  width: 26px; height: 26px; border-radius: 7px; object-fit: cover;
}
#tabbar button:not(.on) .mark { opacity: .55; }
#tabbar button.on { color: var(--acc); }
#tabbar .badge {
  position: absolute; top: -1px; right: calc(50% - 16px);
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px;
  background: var(--copper); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.auth-stack { display: grid; gap: 10px; }
