:root {
  --bg: #14110d;
  --bg-elevated: #1c1712;
  --card: #211b14;
  --card-border: #332a1e;
  --text: #f5efe4;
  --text-muted: #a89a86;
  --text-dim: #7a6d5c;
  --accent: #ff9d1f;
  --accent-2: #ffce3d;
  --accent-grad: linear-gradient(135deg, #ff9d1f 0%, #ffce3d 100%);
  --accent-grad-soft: linear-gradient(135deg, rgba(255,157,31,0.16) 0%, rgba(255,206,61,0.10) 100%);
  --danger: #ff5f56;
  --success: #35c96a;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: radial-gradient(1200px 800px at 50% -10%, #241b0f 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(72px + var(--safe-bottom));
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

::-webkit-scrollbar { height: 6px; width: 6px; }
::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 10px; }

/* ---------- layout ---------- */
.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 14px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: 12px;
  background: linear-gradient(180deg, rgba(20,17,13,0.98) 70%, rgba(20,17,13,0));
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 0 14px;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #1a1206; font-size: 17px;
  flex-shrink: 0;
}

.brand-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--text-muted); }

.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 4px;
  margin-bottom: 4px;
}
.back-btn:active { opacity: 0.6; }

/* ---------- search & filters ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  margin: 0 14px 12px;
}
.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 15px;
}
.search-box input::placeholder { color: var(--text-dim); }
.search-box svg { flex-shrink: 0; color: var(--text-dim); }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 14px 4px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 8px 15px;
  border-radius: 100px;
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s ease;
}
.chip.active {
  background: var(--accent-grad);
  color: #1a1206;
  border-color: transparent;
}

.filter-toggle-row { display: flex; padding: 10px 14px 2px; gap: 8px; }
.filter-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
}
.filter-btn.active { border-color: var(--accent); color: var(--accent-2); }

.filter-panel {
  margin: 10px 14px 4px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  display: none;
}
.filter-panel.open { display: block; animation: slideDown .18s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px);} to {opacity:1; transform:translateY(0);} }

.field-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;}
.price-range { display: flex; gap: 10px; margin-bottom: 12px; }
.price-range input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.price-range input:focus { border-color: var(--accent); }

select.field, .field-select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  margin-bottom: 12px;
}
select.field:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s ease, opacity .15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-grad); color: #1a1206; width: 100%; }
.btn-secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--card-border); width: 100%;}
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--card-border); }
.btn-danger { background: rgba(255,95,86,0.14); color: var(--danger); border: 1px solid rgba(255,95,86,0.3); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 14px;
}
@media (min-width: 480px) {
  .grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 700px) {
  .grid { grid-template-columns: 1fr 1fr 1fr; }
}
@media (min-width: 1100px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 1400px;
    margin: 0 auto;
  }
}

.product-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}
.product-card:active { transform: scale(0.98); }

.product-card .cover {
  width: 100%; aspect-ratio: 1/1;
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim);
  overflow: hidden;
}
.product-card .cover img { width: 100%; height: 100%; object-fit: cover; }

.product-card .info { padding: 10px 11px 12px; }
.product-card .title {
  font-size: 13.5px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 6px; min-height: 34px;
}
.product-card .price { font-size: 15px; font-weight: 800; color: var(--accent-2); }
.product-card .addr {
  font-size: 11.5px; color: var(--text-dim); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 40px; margin-bottom: 10px; }

/* ---------- product detail ---------- */
.hero-cover {
  width: 100%; aspect-ratio: 1/1;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }

.product-title { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.product-price { font-size: 24px; font-weight: 800; color: var(--accent-2); margin-bottom: 14px; }

.info-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
}
.info-row .ic { color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.info-row .lbl { font-size: 12px; color: var(--text-dim); margin-bottom: 2px; }
.info-row .val { font-size: 14.5px; color: var(--text); }

.section-title { font-size: 16px; font-weight: 700; margin: 22px 0 10px; }

.pickup-list { display: flex; flex-direction: column; gap: 10px; }
.pickup-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card);
  transition: border-color .15s ease;
}
.pickup-row:hover { border-color: var(--accent); }
.pickup-row .pickup-name { font-size: 14px; line-height: 1.35; }
.pickup-row .btn { width: auto; flex-shrink: 0; white-space: nowrap; }

.desc-text { color: var(--text-muted); font-size: 14.5px; white-space: pre-wrap; }

.char-list { display: flex; flex-direction: column; gap: 0; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--card-border); }
.char-row { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; background: var(--card); font-size: 13.5px; }
.char-row:nth-child(even) { background: var(--bg-elevated); }
.char-row .k { color: var(--text-dim); }
.char-row .v { color: var(--text); font-weight: 600; text-align: right; }

.review-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.review-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.review-name { font-weight: 700; font-size: 13.5px; }
.review-stars { color: var(--accent-2); font-size: 13px; letter-spacing: 1px; }
.review-text { font-size: 13.5px; color: var(--text-muted); }
.review-date { font-size: 11px; color: var(--text-dim); margin-top: 6px; }

.sticky-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 14px calc(12px + var(--safe-bottom));
  background: linear-gradient(0deg, rgba(20,17,13,0.98) 60%, rgba(20,17,13,0));
  z-index: 30;
}
.sticky-footer .container { max-width: 640px; margin: 0 auto; padding: 0; }

/* ---------- bottom nav ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex;
  background: var(--bg-elevated);
  border-top: 1px solid var(--card-border);
  padding: 8px 10px calc(8px + var(--safe-bottom));
  z-index: 40;
}
.bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
}
.bottom-nav a.active { color: var(--accent-2); }
.bottom-nav a svg { width: 22px; height: 22px; }

/* ---------- payment page ---------- */
.pay-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.pay-sum {
  text-align: center;
  padding: 18px 0 20px;
  border-bottom: 1px dashed var(--card-border);
  margin-bottom: 16px;
}
.pay-sum .lbl { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.pay-sum .amount { font-size: 34px; font-weight: 800; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.req-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--card-border);
  gap: 10px;
}
.req-row:last-child { border-bottom: none; }
.req-row .lbl { font-size: 12.5px; color: var(--text-dim); }
.req-row .val { font-size: 15px; font-weight: 700; text-align: right; }
.copy-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  color: var(--accent-2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.notice {
  display: flex; gap: 10px;
  background: var(--accent-grad-soft);
  border: 1px solid rgba(255,157,31,0.28);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 13px;
  color: #f0d9ab;
  margin-bottom: 16px;
}

.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 700;
}
.status-pending_payment { background: rgba(255,157,31,0.15); color: var(--accent-2); }
.status-paid { background: rgba(53,201,106,0.15); color: var(--success); }
.status-cancelled { background: rgba(255,95,86,0.15); color: var(--danger); }

/* ---------- history ---------- */
.order-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}
.order-head { display: flex; gap: 10px; margin-bottom: 10px; }
.order-head img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--bg-elevated); flex-shrink: 0; }
.order-head .meta { flex: 1; min-width: 0; }
.order-head .name { font-weight: 700; font-size: 14px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-head .price { color: var(--accent-2); font-weight: 700; font-size: 14px; }
.order-id { font-size: 11.5px; color: var(--text-dim); }
.order-actions { display: flex; gap: 8px; margin-top: 12px; }
.order-actions .btn { flex: 1; }

/* ---------- loading / toast ---------- */
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--card-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #2a2116; border: 1px solid var(--card-border);
  color: var(--text); padding: 11px 18px; border-radius: 100px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: all .25s ease;
  z-index: 100;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- forms (product card / reviews) ---------- */
textarea.field {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  margin-bottom: 10px;
}
textarea.field:focus, input.field:focus { border-color: var(--accent); }
input.field {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  outline: none;
  margin-bottom: 10px;
}

.star-picker { display: flex; gap: 6px; margin-bottom: 10px; }
.star-picker span { font-size: 24px; cursor: pointer; color: var(--card-border); }
.star-picker span.active { color: var(--accent-2); }

.page-pad { padding: 14px; }
.mb-0 { margin-bottom: 0 !important; }
