:root {
  --green: #03ac0e;
  --green-dark: #028a0b;
  --green-light: #e8f8e9;
  --orange: #ff5722;
  --text: #212121;
  --text-2: #6d7588;
  --border: #e5e7e9;
  --bg: #f3f4f5;
  --white: #fff;
  --radius: 10px;
  --shadow: 0 1px 6px rgba(49, 53, 59, 0.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- header ---------- */
.header { background: var(--white); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px;
}
.logo { font-size: 22px; font-weight: 800; color: var(--green); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.logo em { font-style: normal; font-weight: 400; color: var(--text-2); font-size: 16px; }
.search-bar {
  flex: 1; display: flex; border: 1.5px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--white); transition: border-color .15s;
}
.search-bar:focus-within { border-color: var(--green); }
.search-bar input { flex: 1; border: 0; outline: 0; padding: 9px 14px; }
.search-bar button { border: 0; background: var(--white); padding: 0 14px; font-size: 15px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { position: relative; font-size: 21px; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--green-light); }
.cart-badge {
  position: absolute; top: -2px; right: -2px; background: var(--orange); color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 5px; min-width: 16px; text-align: center;
}
.user-chip { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-menu { position: relative; }
.user-dropdown {
  position: absolute; right: 0; top: 42px; background: var(--white); border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.15); min-width: 180px; overflow: hidden; display: none;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown a, .user-dropdown button {
  display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: none; font-size: 14px;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: var(--green-light); }

.category-strip {
  max-width: 1200px; margin: 0 auto; padding: 0 16px 10px; display: flex; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--border); background: var(--white); border-radius: 16px;
  padding: 5px 14px; font-size: 13px; white-space: nowrap; color: var(--text-2);
}
.chip:hover, .chip.active { border-color: var(--green); color: var(--green); background: var(--green-light); }

/* ---------- layout ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; min-height: 70vh; }
.section-title { font-size: 18px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--text-2); }

.hero {
  background: linear-gradient(120deg, var(--green) 0%, #4caf50 60%, #8bc34a 100%);
  color: #fff; border-radius: 14px; padding: 34px 30px; margin-bottom: 8px;
}
.hero h1 { font-size: 26px; margin-bottom: 6px; }
.hero p { opacity: .92; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 14px; }
.card {
  background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(49,53,59,.2); }
.card-img { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 64px; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-name {
  font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; min-height: 35px;
}
.card-price { font-weight: 800; font-size: 15px; }
.card-meta { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.star { color: #ffc400; }
.card-shop { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; margin-top: auto; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 8px; padding: 10px 18px; font-weight: 700; font-size: 14px;
  background: var(--green); color: #fff; transition: background .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--green-dark); }
.btn:disabled { background: #c5c9cc; cursor: not-allowed; }
.btn-outline { background: var(--white); color: var(--green); border: 1.5px solid var(--green); }
.btn-outline:hover { background: var(--green-light); }
.btn-ghost { background: none; color: var(--text-2); border: 1px solid var(--border); font-weight: 500; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { background: #fff; color: #e02954; border: 1.5px solid #e02954; }
.btn-danger:hover { background: #fdecef; }

/* ---------- panel / form ---------- */
.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.form-narrow { max-width: 420px; margin: 30px auto; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; outline: 0;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--green); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { text-align: center; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.form-hint a { color: var(--green); font-weight: 600; }

/* ---------- product detail ---------- */
.detail { display: grid; grid-template-columns: 340px 1fr 300px; gap: 20px; align-items: start; }
.detail-img { border-radius: var(--radius); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 150px; box-shadow: var(--shadow); }
.detail-info h1 { font-size: 19px; line-height: 1.4; margin-bottom: 6px; }
.detail-price { font-size: 28px; font-weight: 800; margin: 10px 0; }
.detail-desc { margin-top: 16px; line-height: 1.7; color: #444; white-space: pre-line; }
.shop-box {
  display: flex; align-items: center; gap: 10px; margin-top: 18px; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.buy-box { position: sticky; top: 130px; }
.qty-control { display: flex; align-items: center; gap: 6px; margin: 12px 0; }
.qty-control button {
  width: 32px; height: 32px; border: 1.5px solid var(--border); background: var(--white);
  border-radius: 8px; font-size: 16px; font-weight: 700; color: var(--green);
}
.qty-control input { width: 56px; text-align: center; padding: 6px; border: 1.5px solid var(--border); border-radius: 8px; }
.buy-box .subtotal { display: flex; justify-content: space-between; margin: 12px 0; font-size: 15px; }
.buy-box .subtotal strong { font-size: 17px; }
.buy-actions { display: flex; flex-direction: column; gap: 8px; }

.review { border-top: 1px solid var(--border); padding: 12px 0; }
.review-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.review-head .avatar { width: 26px; height: 26px; font-size: 12px; }

/* ---------- cart ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.cart-item { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); align-items: center; }
.cart-item:last-child { border-bottom: 0; }
.cart-thumb { width: 70px; height: 70px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 34px; flex-shrink: 0; }
.cart-info { flex: 1; min-width: 0; }
.cart-info .name { font-size: 14px; margin-bottom: 2px; }
.cart-info .price { font-weight: 700; }
.cart-actions { display: flex; align-items: center; gap: 10px; }
.link-danger { color: #e02954; background: none; border: 0; font-size: 13px; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.summary-total { border-top: 1px solid var(--border); padding-top: 10px; font-weight: 800; font-size: 16px; }

/* ---------- orders ---------- */
.order-card { margin-bottom: 14px; }
.order-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.badge { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.badge-wait { background: #fff3e0; color: #e65100; }
.badge-ship { background: #e3f2fd; color: #1565c0; }
.badge-done { background: var(--green-light); color: var(--green-dark); }
.order-items { display: flex; flex-direction: column; gap: 8px; }
.order-item { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.order-thumb { width: 44px; height: 44px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.order-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ---------- seller ---------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stat .num { font-size: 22px; font-weight: 800; color: var(--green); }
.stat .lbl { font-size: 13px; color: var(--text-2); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.tbl th { color: var(--text-2); font-weight: 600; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .big { font-size: 56px; margin-bottom: 10px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #2e3137; color: #fff; padding: 12px 22px; border-radius: 8px; z-index: 999;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); font-size: 14px; max-width: 90vw;
}
.toast.success { background: var(--green-dark); }
.toast.error { background: #d6001c; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 22px; }
.pagination button {
  min-width: 34px; padding: 7px 10px; border: 1px solid var(--border); background: var(--white); border-radius: 8px;
}
.pagination button.active { background: var(--green); color: #fff; border-color: var(--green); }
.rating-input { display: flex; gap: 4px; font-size: 26px; cursor: pointer; }
.rating-input span { color: #ccc; }
.rating-input span.on { color: #ffc400; }
.footer { background: var(--white); border-top: 1px solid var(--border); padding: 24px 16px; text-align: center; color: var(--text-2); }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .buy-box { position: static; }
  .cart-layout { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
  .search-bar { order: 3; flex-basis: 100%; }
  .stats-row { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
