:root {
  --bg: #FAF8F3;
  --surface: #FFFFFF;
  --surface-soft: #F3F6EF;
  --ink: #24332C;
  --ink-soft: #6C7B72;
  --line: #E7EBE2;
  --green: #2E5B4C;
  --green-light: #8FBF6A;
  --green-pale: #E8F1E3;
  --accent: #E8A063;
  --danger: #C4553D;
  --shadow: 0 8px 28px rgba(46, 91, 76, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }

.page { max-width: 540px; margin: 0 auto; padding: 0 16px 120px; }

.shop-header {
  margin: 16px 0 12px;
  padding: 20px 18px 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, #EAF3E4 0%, #F7F4EA 62%, #FBF6EC 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.brand-row { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 15px;
  background: var(--green);
  color: #EAF3E4;
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-text { flex: 1; min-width: 0; }
.brand-text h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); }
.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px; background: rgba(255,255,255,0.8);
  border: 1px solid var(--line); color: var(--green);
}
.icon-btn svg { width: 20px; height: 20px; }
.announcement {
  margin-top: 14px; padding: 10px 12px;
  border-radius: 12px; background: rgba(255,255,255,0.72);
  font-size: 12.5px; color: var(--ink-soft);
  border-left: 3px solid var(--green-light);
}

.category-nav {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 0 12px; scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; padding: 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink-soft); white-space: nowrap;
}
.cat-chip.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }

.product-list { display: grid; gap: 12px; }
.loading { padding: 40px 0; text-align: center; color: var(--ink-soft); font-size: 13px; }
.section-title { margin: 4px 0 2px; font-size: 13px; font-weight: 600; color: var(--ink-soft); letter-spacing: 1px; }

.product-card {
  display: flex; gap: 14px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 3px 14px rgba(46,91,76,0.04);
}
.product-thumb {
  position: relative; width: 92px; height: 92px; flex: none;
  border-radius: 14px; overflow: hidden;
  background: linear-gradient(145deg, #DCEBD0, #F3E7CE);
  display: grid; place-items: center; color: rgba(46,91,76,0.35);
}
.product-thumb:nth-child(2n) { background: linear-gradient(145deg, #E6EFD8, #F7E9D4); }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb svg { width: 46px; height: 46px; }
.product-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.product-name { font-size: 15.5px; font-weight: 650; margin: 0; }
.product-desc {
  margin: 3px 0 0; font-size: 12px; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.tag { font-size: 10.5px; padding: 1px 7px; border-radius: 6px; background: var(--green-pale); color: var(--green); }
.product-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.price { color: var(--green); font-weight: 700; font-size: 17px; }
.price small { font-size: 11px; font-weight: 500; }
.qty-ctrl { display: flex; align-items: center; gap: 9px; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line); color: var(--green); font-size: 18px; line-height: 1;
}
.qty-btn.plus { background: var(--green); color: #fff; border-color: var(--green); }
.qty-num { min-width: 16px; text-align: center; font-size: 14px; font-weight: 600; }
.soldout-tag { font-size: 12px; color: var(--danger); border: 1px solid #EBCFC7; padding: 4px 10px; border-radius: 8px; }
.product-card.is-soldout .product-thumb { filter: grayscale(0.55); opacity: 0.75; }

.foot-note { display: flex; justify-content: space-between; margin-top: 28px; font-size: 11.5px; color: #9AA79D; }
.compliance { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0 4px; font-size: 11px; }
.compliance a { color: #8A9A8E; text-decoration: none; }
.compliance a:hover { color: var(--green); text-decoration: underline; }

.cart-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px;
  width: calc(100% - 32px); max-width: 508px; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px 11px 14px;
  background: rgba(255,255,255,0.96); backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 10px 34px rgba(36,51,44,0.16);
}
.cart-icon { position: relative; width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--green-pale); color: var(--green); }
.cart-icon svg { width: 22px; height: 22px; }
.cart-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.cart-total { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.cart-total strong { font-size: 18px; color: var(--green); }
.cart-total span { font-size: 11px; color: var(--ink-soft); }
.btn-primary {
  padding: 11px 20px; border-radius: 13px; background: var(--green); color: #fff;
  font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn-primary:disabled { background: #B9C6BC; }

.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(24,38,31,0.42); }
.sheet {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 31;
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 40px rgba(24,38,31,0.18);
}
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #D7DFD4; margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-title { margin: 0; font-size: 18px; font-weight: 700; }
.sheet-close { font-size: 13px; color: var(--ink-soft); padding: 6px 8px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.panel-title { font-size: 13px; font-weight: 650; color: var(--ink-soft); margin: 0 0 10px; }
.type-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.type-tab { padding: 9px 4px; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--line); font-size: 12px; color: var(--ink-soft); text-align: center; }
.type-tab.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; }
.type-hint { font-size: 12px; color: var(--ink-soft); background: var(--green-pale); padding: 9px 11px; border-radius: 10px; margin-bottom: 12px; }

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface-soft); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green-light); background: #fff; }
.field textarea { resize: vertical; min-height: 62px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.coupon-row { display: flex; gap: 8px; }
.coupon-row input { flex: 1; }
.btn-soft { padding: 9px 14px; border-radius: 11px; background: var(--green-pale); color: var(--green); font-size: 13px; font-weight: 600; white-space: nowrap; }
.coupon-msg { font-size: 12px; margin-top: 6px; color: var(--ink-soft); }
.coupon-msg.error { color: var(--danger); }
.coupon-msg.success { color: var(--green); }

.cart-lines { display: grid; gap: 8px; }
.cart-line { display: flex; justify-content: space-between; font-size: 13px; }
.cart-line span:last-child { color: var(--ink-soft); }
.summary-line { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 13px; }
.summary-line.discount { color: var(--accent); }
.summary-line.total { font-size: 16px; font-weight: 700; color: var(--green); border-top: 1px solid var(--line); margin-top: 10px; }
.submit-btn { width: 100%; padding: 14px; border-radius: 14px; background: var(--green); color: #fff; font-weight: 700; font-size: 15px; }
.submit-btn:disabled { background: #B9C6BC; }

.order-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px; margin-bottom: 10px; }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.order-no { font-size: 13px; font-weight: 650; }
.status-pill { font-size: 11px; padding: 3px 9px; border-radius: 8px; background: var(--green-pale); color: var(--green); }
.status-pill.pending { background: #FBEBDC; color: #B26B2C; }
.status-pill.cancelled { background: #F0F0EC; color: #8A938C; }
.order-meta { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.order-items { font-size: 12.5px; color: var(--ink); margin-top: 6px; }
.order-total { text-align: right; font-weight: 700; color: var(--green); margin-top: 8px; }

.success-box { text-align: center; padding: 14px 0 6px; }
.success-mark { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-pale); color: var(--green); display: grid; place-items: center; }
.success-mark svg { width: 30px; height: 30px; }
.success-box h3 { margin: 0 0 6px; font-size: 19px; }
.success-box p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.success-order-no { display: inline-block; margin: 12px 0; padding: 8px 16px; border-radius: 10px; background: var(--surface-soft); font-weight: 700; letter-spacing: 1px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%); z-index: 50;
  padding: 10px 18px; border-radius: 12px; background: rgba(36,51,44,0.92); color: #fff;
  font-size: 13px; max-width: 88%; text-align: center;
}
.empty { text-align: center; padding: 30px 0; color: var(--ink-soft); font-size: 13px; }

@media (min-width: 700px) {
  .page { padding-top: 20px; }
  .product-list { grid-template-columns: 1fr 1fr; }
  .section-title { grid-column: 1 / -1; }
}
