:root {
  --cream: #FBF7EF;
  --card: #FFFFFF;
  --ink: #23281F;
  --muted: #6E7566;
  --green: #2F6B42;
  --green-dark: #245234;
  --green-soft: #E6F0E7;
  --line: #E9E3D6;
  --red-soft: #F6E7E3;
  --red: #B4472E;
  --shadow: 0 2px 10px rgba(35, 40, 31, 0.06);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.4;
}

img { max-width: 100%; display: block; }

.wrap { max-width: 620px; margin: 0 auto; padding: 0 16px; }

/* Header */
header.site {
  text-align: center;
  padding: 28px 16px 18px;
}
header.site h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.3px;
}
header.site p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 17px;
}

/* Catalog list */
.catalog { padding-bottom: 130px; }

.item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  padding: 12px;
  margin: 12px 0;
  align-items: center;
}
.item .photo {
  width: 84px;
  height: 84px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--green-soft);
  flex: 0 0 auto;
}
.item .photo.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 34px;
}
.item .info { flex: 1 1 auto; min-width: 0; }
.item .name { font-weight: 650; font-size: 19px; }
.item .unit { color: var(--muted); font-size: 15px; margin-top: 2px; }
.item .price { font-weight: 700; font-size: 19px; margin-top: 4px; color: var(--green-dark); }

/* Quantity stepper */
.stepper { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.stepper button {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--green);
  background: #fff;
  color: var(--green);
  font-size: 26px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:active { background: var(--green-soft); }
.stepper .qty { min-width: 22px; text-align: center; font-weight: 700; font-size: 20px; }
.stepper button.minus[disabled] { opacity: 0.3; border-color: var(--line); color: var(--muted); }

/* Basket bar */
.basket {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(251, 247, 239, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  transform: translateY(120%);
  transition: transform 0.25s ease;
}
.basket.show { transform: translateY(0); }
.basket .inner { max-width: 620px; margin: 0 auto; }
.basket .summary { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.basket .summary .count { color: var(--muted); font-size: 15px; }
.basket .summary .total { font-weight: 800; font-size: 22px; }
.btn-order {
  display: block; width: 100%;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.btn-order:active { background: var(--green-dark); }
.pay-note {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 0;
}
.pay-note b { color: var(--ink); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}

footer.site {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 24px 16px 40px;
}

/* ---------- Admin ---------- */
.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 10px;
}
.admin-head h1 { font-size: 22px; margin: 0; }
.saved-pill {
  font-size: 14px; color: var(--green); font-weight: 600;
  opacity: 0; transition: opacity 0.2s;
}
.saved-pill.show { opacity: 1; }

.gate { max-width: 360px; margin: 80px auto; text-align: center; padding: 0 20px; }
.gate h1 { font-size: 24px; }
.gate input {
  width: 100%; font-size: 26px; text-align: center; letter-spacing: 6px;
  padding: 14px; border: 2px solid var(--line); border-radius: 14px; margin: 16px 0;
}
.gate button { width: 100%; }
.gate .err { color: var(--red); font-size: 15px; min-height: 20px; }

.aitem {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  margin: 12px 0;
}
.aitem.sold { opacity: 0.6; }
.aitem .row1 { display: flex; gap: 12px; align-items: center; }
.aphoto {
  width: 68px; height: 68px; border-radius: 12px; object-fit: cover;
  background: var(--green-soft); flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
  cursor: pointer; position: relative; overflow: hidden;
}
.aphoto input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.aitem .fields { flex: 1 1 auto; min-width: 0; }
.aitem input.name {
  font-size: 18px; font-weight: 650; border: none; border-bottom: 1.5px dashed var(--line);
  width: 100%; padding: 4px 0; background: transparent; color: var(--ink);
}
.aitem .priceline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.aitem .priceline .cur { color: var(--muted); font-weight: 700; }
.aitem input.price {
  font-size: 18px; font-weight: 700; width: 78px; border: 1.5px solid var(--line);
  border-radius: 10px; padding: 6px 8px; color: var(--green-dark);
}
.aitem input.unit {
  font-size: 15px; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 6px 8px; flex: 1 1 auto; min-width: 0; color: var(--muted);
}
.aitem .row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }

/* Big toggle */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle .track {
  width: 62px; height: 34px; border-radius: 20px; background: #CFC9BB; position: relative;
  transition: background 0.2s;
}
.toggle .knob {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: left 0.2s;
}
.toggle.on .track { background: var(--green); }
.toggle.on .knob { left: 31px; }
.toggle .label { font-weight: 650; font-size: 15px; }
.toggle.on .label { color: var(--green-dark); }
.toggle .label.off { color: var(--red); }

.btn-del {
  background: none; border: none; color: var(--red); font-size: 15px;
  cursor: pointer; padding: 8px; font-weight: 600;
}

.btn {
  background: var(--green); color: #fff; border: none; border-radius: 14px;
  padding: 15px 18px; font-size: 18px; font-weight: 700; cursor: pointer;
}
.btn:active { background: var(--green-dark); }
.btn.block { display: block; width: 100%; }
.btn.ghost { background: #fff; color: var(--green); border: 1.5px solid var(--green); }

.add-area { margin: 18px 0 60px; }

.uploading { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ---------- v2: branding, language toggle, sold-out ---------- */
header.site { position: relative; background: linear-gradient(180deg, var(--green-soft), rgba(230,240,231,0) 90%); }
.logo { width: 54px; height: 54px; margin: 0 auto 6px; display: block; }

.lang-toggle {
  position: absolute; top: 14px; right: 14px;
  display: flex; gap: 2px; background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px; box-shadow: var(--shadow);
}
.lang-toggle button {
  border: none; background: none; padding: 6px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.lang-toggle button.active { background: var(--green); color: #fff; }

.sold-divider {
  text-align: center; color: var(--muted); font-size: 13px; font-weight: 700;
  margin: 28px 0 4px; text-transform: uppercase; letter-spacing: 0.6px;
}
.item.sold-out { opacity: 0.6; }
.item.sold-out .price { color: var(--muted); }
.badge-sold {
  display: inline-block; margin-top: 5px; font-size: 12px; font-weight: 700;
  color: var(--red); background: var(--red-soft); padding: 2px 9px; border-radius: 6px;
}

/* Admin: delete-photo badge */
.aphoto-wrap { position: relative; flex: 0 0 auto; }
.photo-del {
  position: absolute; top: -7px; right: -7px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: #fff; border: 2px solid #fff;
  font-size: 16px; line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.photo-del:active { background: #8f371f; }

/* How-to-pay panel */
.catalog { padding-bottom: 16px; }
.howpay { padding: 4px 16px 0; }
.howpay-card {
  background: var(--green-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.howpay-card h3 { margin: 0 0 10px; font-size: 18px; }
.howpay-card ol { margin: 0 0 14px; padding-left: 22px; }
.howpay-card ol li { margin: 5px 0; font-size: 16px; }
.pay-number-row {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.pay-number { font-size: 20px; font-weight: 800; color: var(--green-dark); flex: 1; letter-spacing: 0.5px; }
.copy-btn {
  background: var(--green); color: #fff; border: none; border-radius: 10px;
  padding: 10px 16px; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.copy-btn:active, .copy-btn.done { background: var(--green-dark); }
footer.site { padding-bottom: 150px; }

/* Order capture fields in the basket bar */
.order-fields { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ofield {
  width: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 16px; background: #fff; color: var(--ink);
}
.ofield:focus { outline: none; border-color: var(--green); }
.fulfill { display: flex; gap: 8px; }
.fbtn {
  flex: 1; padding: 12px; border: 1.5px solid var(--green); border-radius: 12px;
  background: #fff; color: var(--green-dark); font-size: 15px; font-weight: 700; cursor: pointer;
}
.fbtn.active { background: var(--green); color: #fff; }
