/* Venda Garantida - mobile-first, low-bandwidth.
   Keep this file pure ASCII: build_artifact.py bundles it into a shared page
   that may be served without a charset header. See that script.
   No framework: on Mozambican mobile data, every kilobyte is money.
   Designed for small, low-end Android screens first; widens on desktop. */

:root {
  --green: #00694E;
  --green-dark: #004E3A;
  --green-soft: #E6F2EE;
  --amber: #B26A00;
  --amber-soft: #FFF4E0;
  --red: #B3261E;
  --red-soft: #FDECEA;
  --ink: #1A1C1B;
  --muted: #5F6B66;
  --line: #DDE4E1;
  --bg: #F7F9F8;
  --card: #FFFFFF;
  --radius: 12px;
  --tap: 48px; /* minimum touch target */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding-bottom: 72px;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 .75rem; }
a { color: inherit; text-decoration: none; }

/* ---- chrome ---- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .75rem 1rem;
  background: var(--green); color: #fff;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.topbar-link { font-size: .85rem; opacity: .9; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: .4rem; font-size: .7rem; color: var(--muted);
}
.tabbar svg { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--green); font-weight: 600; }

.view { padding: 1rem; max-width: 720px; margin: 0 auto; }

/* ---- search ---- */

.search {
  width: 100%; min-height: var(--tap); padding: .7rem 1rem;
  font-size: 1rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--card);
}

/* ---- listing cards ---- */

.grid { display: grid; gap: .75rem; grid-template-columns: repeat(2, 1fr); margin-top: 1rem; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.card-media {
  aspect-ratio: 1; display: grid; place-items: center;
  background: var(--green-soft); font-size: 2.5rem;
}
.card-body { padding: .6rem .7rem .75rem; }
.card-title {
  font-size: .85rem; font-weight: 600; margin-bottom: .3rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.price { font-weight: 700; color: var(--green-dark); }
.price-sub { font-size: .7rem; color: var(--muted); font-weight: 400; }

/* ---- badges ---- */

.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .5rem; border-radius: 999px;
  font-size: .68rem; font-weight: 600; white-space: nowrap;
}
.badge-stock { background: var(--green-soft); color: var(--green-dark); }
.badge-import { background: var(--amber-soft); color: var(--amber); }
.badge-verified { background: var(--green-soft); color: var(--green-dark); }

/* ---- detail ---- */

.hero { aspect-ratio: 4/3; display: grid; place-items: center;
        background: var(--green-soft); font-size: 5rem; border-radius: var(--radius); }
.detail-price { font-size: 1.6rem; font-weight: 700; color: var(--green-dark); }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem; margin: 1rem 0;
}
.panel-flag { border-left: 4px solid var(--amber); background: var(--amber-soft); }
.panel-safe { border-left: 4px solid var(--green); background: var(--green-soft); }

.rowline { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; }
.rowline + .rowline { border-top: 1px solid var(--line); }
.rowline dt { color: var(--muted); font-size: .9rem; }
.rowline dd { margin: 0; font-weight: 600; text-align: right; }

/* ---- buttons ---- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  width: 100%; min-height: var(--tap); padding: .8rem 1rem;
  font: inherit; font-weight: 600; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn + .btn { margin-top: .5rem; }

/* ---- disclosure (the pros/cons gate) ---- */

.disclosure h3 { display: flex; align-items: center; gap: .4rem; margin-top: 1rem; }
.disclosure ul { margin: 0 0 .5rem; padding-left: 1.15rem; }
.disclosure li { margin-bottom: .4rem; }
.pros li::marker { color: var(--green); }
.cons li::marker { color: var(--red); }

.consent {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: 1rem; margin: 1rem 0;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  cursor: pointer;
}
.consent input { width: 22px; height: 22px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--green); }
.consent:has(input:checked) { border-color: var(--green); background: var(--green-soft); }

/* ---- escrow timeline ---- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .85rem; padding-bottom: 1.1rem; position: relative; }
.timeline li:not(:last-child)::before {
  content: ""; position: absolute; left: 11px; top: 26px; bottom: 0; width: 2px;
  background: var(--line);
}
.timeline li.done:not(:last-child)::before { background: var(--green); }
.dot {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; font-size: .7rem; font-weight: 700;
  background: var(--line); color: var(--muted);
}
.done .dot { background: var(--green); color: #fff; }
.current .dot { background: var(--amber); color: #fff; }
.failed .dot { background: var(--red); color: #fff; }
.step-title { font-weight: 600; font-size: .95rem; }
.step-note { font-size: .8rem; color: var(--muted); }

/* ---- misc ---- */

.money-held {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem; border-radius: var(--radius);
  background: var(--green); color: #fff; margin-bottom: 1rem;
}
.money-held strong { display: block; font-size: 1.25rem; }
.money-held span { font-size: .8rem; opacity: .9; }

.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.muted { color: var(--muted); font-size: .85rem; }
.back { display: inline-block; padding: .5rem 0; color: var(--muted); font-size: .9rem; }

.field { display: block; margin-bottom: 1rem; }
.field span { display: block; margin-bottom: .35rem; font-size: .9rem; font-weight: 600; }
.field input {
  width: 100%; min-height: var(--tap); padding: .7rem 1rem;
  font-size: 1rem; border: 1px solid var(--line); border-radius: var(--radius);
}

.order-row {
  display: flex; gap: .85rem; align-items: center; padding: .85rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: .6rem;
}
.order-thumb {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px;
  display: grid; place-items: center; background: var(--green-soft); font-size: 1.5rem;
}
.order-main { flex: 1; min-width: 0; }
.order-title { font-weight: 600; font-size: .9rem; }

/* Seller identity. The seal is a registered company's mark, so it is set
   quietly next to the name rather than treated as a badge - a mark that
   announces itself reads as advertising, not provenance. */
.seller-cell {
  display: flex; align-items: center; justify-content: flex-end;
  gap: .45rem; flex-wrap: wrap;
}
.seller-seal { flex-shrink: 0; border-radius: 50%; display: block; }
.legal-name {
  font-weight: 400; font-size: .78rem; color: var(--muted);
  letter-spacing: .01em;
}

/* ---- desktop -----------------------------------------------------------
   Mobile is the primary surface: most buyers are on a low-end Android phone.
   But the app is also shown on laptops - to partners, and to sellers managing
   listings - and a phone column stranded in the middle of a monitor reads as
   unfinished. So above 760px the bottom tab bar becomes a top nav row, the
   grid widens, and the product page splits in two.

   Body is laid out with flex + order on desktop because the tab bar sits after
   <main> in the DOM (correct for mobile, where it is fixed to the bottom) and
   needs to appear above it here. */

@media (min-width: 760px) {
  body { display: flex; flex-direction: column; min-height: 100vh; padding-bottom: 0; }
  .topbar { order: 0; }
  main { order: 2; flex: 1; }

  .topbar { padding: .85rem 1.5rem; }
  .brand span { font-size: 1.05rem; }

  .tabbar {
    order: 1;
    position: static; transform: none;
    justify-content: center; gap: .5rem;
    padding: 0 1rem; border-top: 0; border-bottom: 1px solid var(--line);
  }
  .tabbar a {
    flex: 0 0 auto; flex-direction: row; gap: .45rem;
    padding: .8rem 1rem; font-size: .85rem;
    border-bottom: 2px solid transparent;
  }
  .tabbar a[aria-current="page"] { border-bottom-color: var(--green); }
  .tabbar svg { width: 18px; height: 18px; }

  .view { max-width: 1080px; padding: 1.75rem 1.5rem 3rem; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; }
  .card-title { font-size: .92rem; }

  h1 { font-size: 1.6rem; }

  /* Product page: media beside the details, not stacked. */
  .detail-grid {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 2rem; align-items: start;
  }
  .detail-media { position: sticky; top: 1.5rem; }
  .hero { aspect-ratio: 1; font-size: 7rem; }
  .detail-info > h1 { margin-top: 0; }
  .detail-price { font-size: 1.9rem; }

  /* Forms stay readable rather than stretching the full width. */
  .field, .consent, .search, .btn { max-width: 560px; }
  .disclosure .panel, .panel { max-width: 720px; }

  /* A single-column list of orders looks lost on a wide screen. */
  .order-row { max-width: 720px; }
}

/* Very wide: cap the reading measure rather than letting cards sprawl. */
@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}
