:root {
  --green: #0d6b3b;
  --green-2: #16864e;
  --mint: #edf8f2;
  --bg: #f4faf7;
  --card: #ffffff;
  --ink: #102b20;
  --muted: #6b7f75;
  --line: #d9e8e0;
  --warn: #9b6500;
  --danger: #b42318;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
button, input, textarea, select { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }

.locked-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}
.locked-card {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 18px 48px rgba(16, 43, 32, .12);
}
.locked-card strong { color: var(--green); font-size: 24px; }
.locked-card h1 { margin: 20px 0 10px; }
.locked-card p { color: var(--muted); line-height: 1.6; }
.locked-card a {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  margin-top: 12px;
  padding: 0 16px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.app { max-width: 980px; margin: 0 auto; }
.app-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px 10px;
  background: rgba(244, 250, 247, .94);
  border-bottom: 1px solid rgba(217, 232, 224, .9);
  backdrop-filter: blur(14px);
}
.brand-block { min-width: 0; }
.brand-block span { display: block; color: var(--green); font-size: 13px; font-weight: 900; }
.brand-block strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 20px;
}
.brand-block small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}
.ghost-button, .text-button {
  min-height: 40px;
  border-radius: 8px;
  background: #e3f0e9;
  color: var(--green);
  padding: 0 12px;
  font-weight: 900;
}

.search-shell {
  position: sticky;
  top: 74px;
  z-index: 19;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(244, 250, 247, .94);
  backdrop-filter: blur(14px);
}
.search-shell input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 14px;
  color: var(--ink);
  outline: 0;
  font-weight: 800;
}
.icon-button {
  height: 48px;
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  border: 1px solid var(--line);
  font-size: 24px;
  font-weight: 900;
}

main { padding: 0 12px 26px; }
.view { display: none; }
.view.active { display: block; }

.hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin: 4px 0 12px;
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0d6b3b, #1f8d59);
  color: #fff;
  box-shadow: 0 16px 40px rgba(13, 107, 59, .22);
}
.hero-card span { display: inline-flex; margin-bottom: 8px; padding: 5px 8px; border-radius: 999px; background: rgba(255,255,255,.17); font-size: 12px; font-weight: 900; }
.hero-card h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.hero-card p { margin: 8px 0 0; color: rgba(255,255,255,.82); line-height: 1.45; }
.hero-card button {
  min-height: 48px;
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  padding: 0 14px;
  font-weight: 950;
  white-space: nowrap;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.shortcut-grid button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  font-weight: 950;
}

.strip-section, .panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 10px 28px rgba(16, 43, 32, .06);
}
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; font-size: 20px; }
.section-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.promo-row { display: grid; gap: 8px; }
.promo-card, .hint {
  padding: 11px 12px;
  border-radius: 8px;
  background: #fff7e8;
  color: #7a4b00;
  font-weight: 900;
}
.promo-card strong { display: block; }
.promo-card span { display: block; margin-top: 4px; font-size: 12px; }
.hint.ok { background: var(--mint); color: var(--green); }
.hint-list { display: grid; gap: 8px; margin-bottom: 10px; }

.product-list { display: grid; gap: 10px; }
.product-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.product-image {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--mint);
  color: var(--green);
  font-size: 40px;
  font-weight: 950;
}
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-info { min-width: 0; }
.product-title {
  display: flex;
  gap: 8px;
  align-items: start;
}
.product-title h3 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.22;
}
.stock-warning {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  background: #fff7e8;
  color: var(--warn);
  font-size: 11px;
  font-weight: 900;
}
.product-info p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.3; }
.price-row { margin-top: 8px; }
.price-row strong { display: block; color: var(--green); font-size: 22px; font-weight: 950; }
.price-row span { display: block; margin-top: 2px; color: var(--ink); font-size: 13px; font-weight: 850; }
.qty-box {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 44px minmax(54px, 1fr) 72px 76px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.qty-box button, .qty-box input {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--mint);
  color: var(--green);
  text-align: center;
  font-weight: 950;
}
.qty-box input { background: #fff; color: var(--ink); outline: 0; }
.qty-box button:last-child { border-right: 0; }

.category-layout {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.category-side {
  position: sticky;
  top: 136px;
  display: grid;
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf5ef;
}
.category-side button {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #536b60;
  padding: 0 8px;
  text-align: center;
  font-weight: 950;
}
.category-side button.active {
  background: #fff;
  color: var(--green);
  box-shadow: inset 4px 0 0 var(--green);
}
.category-title { position: sticky; top: 136px; z-index: 5; padding: 10px 0; background: var(--bg); }

textarea, select, .order-note textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: 0;
  font-weight: 750;
}
.primary-button, .submit-button {
  width: 100%;
  min-height: 52px;
  margin-top: 10px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 18px;
  font-weight: 950;
}
.ai-result { margin-top: 12px; }
.ai-summary {
  padding: 12px;
  border-radius: 8px;
  background: var(--mint);
}
.ai-summary p { margin: 4px 0; color: var(--ink); }
.ai-list { display: grid; gap: 8px; margin-top: 10px; }
.ai-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px 70px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.ai-item strong, .ai-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-item small { margin-top: 4px; color: var(--muted); }
.ai-item input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; text-align: center; }
.match { display: inline-flex; margin-top: 6px; padding: 4px 7px; border-radius: 999px; font-size: 11px; font-weight: 900; }
.match.matched { background: var(--mint); color: var(--green); }
.match.possible { background: #fff7e8; color: var(--warn); }
.match.unrecognized { background: #fff0f0; color: var(--danger); }

.cart-list, .gift-list, .history-list { display: grid; gap: 9px; }
.cart-item, .gift-item, .history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.cart-item strong, .gift-item strong, .history-item strong { display: block; }
.cart-item small, .gift-item small, .history-item small { display: block; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.cart-item em { display: block; margin-top: 5px; color: var(--warn); font-style: normal; font-weight: 900; }
.cart-item em.danger { color: var(--danger); }
.cart-qty {
  display: grid;
  grid-template-columns: 36px 52px 42px 42px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.cart-qty button, .cart-qty input {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--mint);
  color: var(--green);
  text-align: center;
  font-weight: 950;
}
.cart-qty input { background: #fff; color: var(--ink); outline: 0; }
.cart-qty button:last-child { border-right: 0; color: var(--danger); }
.gift-item { background: #f8fff9; }
.gift-item span, .history-item span {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--mint);
  color: var(--green);
  font-size: 12px;
  font-weight: 950;
}
.total-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.total-card div {
  padding: 12px;
  border-radius: 8px;
  background: var(--mint);
}
.total-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 900; }
.total-card strong { display: block; margin-top: 4px; color: var(--green); font-size: 18px; }
.order-note { display: block; color: var(--muted); font-weight: 900; }
.order-note textarea { margin-top: 7px; }

.contact-panel p { color: var(--muted); line-height: 1.55; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.contact-grid a {
  min-height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 950;
}
.empty { padding: 16px; color: var(--muted); text-align: center; font-weight: 850; }

.cart-summary {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 30;
  width: min(940px, calc(100% - 24px));
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px 10px 14px;
  border-radius: 8px;
  background: #0b5f35;
  color: #fff;
  transform: translateX(-50%);
  box-shadow: 0 14px 32px rgba(13, 107, 59, .32);
}
.cart-summary span, .cart-summary strong { font-weight: 950; }
.cart-summary button {
  min-height: 42px;
  border-radius: 8px;
  background: #fff;
  color: var(--green);
  padding: 0 14px;
  font-weight: 950;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 40;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.97);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}
.bottom-nav button {
  min-height: 48px;
  border-radius: 8px;
  background: transparent;
  color: #6f8078;
  font-size: 13px;
  font-weight: 950;
}
.bottom-nav button.active {
  background: var(--mint);
  color: var(--green);
}

@media (min-width: 760px) {
  .product-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .category-products .product-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-top { padding: 10px 10px 8px; }
  .search-shell { top: 70px; padding: 8px 10px; }
  main { padding: 0 8px 24px; }
  .hero-card { grid-template-columns: 1fr; padding: 16px; }
  .hero-card h1 { font-size: 28px; }
  .shortcut-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip-section, .panel { padding: 12px; }
  .category-layout { grid-template-columns: 104px minmax(0, 1fr); gap: 8px; }
  .category-side { top: 126px; }
  .category-title { top: 126px; }
  .product-card { grid-template-columns: 86px minmax(0, 1fr); gap: 10px; padding: 10px; }
  .product-image { width: 86px; height: 86px; }
  .product-title h3 { font-size: 17px; }
  .price-row strong { font-size: 21px; }
  .qty-box { grid-template-columns: 42px minmax(48px, 1fr) 68px 72px; }
  .ai-item { grid-template-columns: 1fr; }
  .cart-item, .gift-item, .history-item { grid-template-columns: 1fr; }
  .cart-qty { grid-template-columns: 42px minmax(54px, 1fr) 54px 54px; }
  .total-card { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}
