:root {
  --blue: #1677ff;
  --blue-dark: #0b5ed7;
  --red: #f04438;
  --green: #12b76a;
  --amber: #f79009;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f6f9;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: #e9edf3; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.phone {
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  position: relative;
  padding-bottom: 96px;
  box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 800; font-size: 18px; color: var(--blue); }
.topbar-actions { display: flex; gap: 14px; }
.link { font-size: 13px; color: var(--blue); }
.link.dim { color: var(--muted); }

.banner {
  margin: 10px 16px 0; padding: 8px 12px; border-radius: 10px;
  background: #fff8e6; color: #b54708; font-size: 12px; border: 1px solid #fde68a;
}

.view { padding-bottom: 12px; }

/* ---------- 首页 ---------- */
.hero {
  background: linear-gradient(150deg, #1677ff 0%, #0b5ed7 100%);
  color: #fff; padding: 22px 20px 26px; position: relative;
}
.hero h1 { margin: 0; font-size: 21px; font-weight: 800; }
.hero p { margin: 4px 0 0; font-size: 12px; opacity: 0.88; }
.hero .hero-link {
  position: absolute; right: 16px; bottom: 24px; font-size: 12px;
  background: rgba(255, 255, 255, 0.18); padding: 5px 12px; border-radius: 999px;
}

.cats { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: 0 0 auto; padding: 7px 16px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); color: var(--muted); font-size: 13px; cursor: pointer;
}
.cat.active { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }

.grid { display: flex; flex-wrap: wrap; padding: 8px 8px 0; }
.product {
  width: 50%; padding: 8px; cursor: pointer;
  display: flex; flex-direction: column;
}
.product img {
  width: 100%; height: 150px; object-fit: cover; border-radius: 14px 14px 0 0;
  background: #eef1f6; display: block;
}
.pbody { background: #fff; border-radius: 0 0 14px 14px; padding: 8px 10px 12px; flex: 1; display: flex; flex-direction: column; }
.pname { font-size: 13px; line-height: 1.4; height: 38px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pstock { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.pstock.low { color: var(--amber); }
.pfoot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.price { color: var(--red); font-weight: 700; font-size: 16px; }
.price .sym { font-size: 12px; }
.add {
  width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--blue); color: #fff;
  font-size: 17px; line-height: 1; cursor: pointer;
}
.add[disabled] { background: #d1d5db; }

/* ---------- 详情 ---------- */
.detail-img { width: 100%; height: 300px; object-fit: cover; background: #eef1f6; display: block; }
.card {
  background: #fff; border-radius: var(--radius); margin: 12px 16px; padding: 14px;
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.muted { color: var(--muted); font-size: 12px; }
.detail-name { font-size: 18px; font-weight: 700; line-height: 1.4; }
.detail-price { font-size: 26px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.step {
  width: 32px; height: 32px; border-radius: 50%; border: none; background: #f3f4f6;
  font-size: 17px; color: #374151; cursor: pointer;
}
.step-num { width: 40px; text-align: center; font-size: 15px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 999px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer; width: 100%;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary[disabled] { background: #9db8e8; border-color: #9db8e8; }
.btn.ghost { background: #fff; color: var(--blue); border-color: var(--blue); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.btn.link { border: none; background: none; color: var(--blue); width: auto; padding: 6px 0; font-size: 13px; font-weight: 500; }

/* ---------- 购物车 ---------- */
.cart-item { display: flex; gap: 12px; background: #fff; border-radius: var(--radius); margin: 12px 16px; padding: 12px; position: relative; }
.cart-item img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #eef1f6; }
.ci-body { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ci-name { font-size: 14px; font-weight: 600; }
.ci-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; }
.ci-remove { position: absolute; right: 8px; top: 4px; border: none; background: none; color: #9ca3af; font-size: 18px; cursor: pointer; }

.summary { margin: 12px 16px; background: #fff; border-radius: var(--radius); padding: 14px; }
.summary .line { display: flex; justify-content: space-between; font-size: 13px; color: #4b5563; padding: 4px 0; }
.summary .line.total { border-top: 1px solid #f3f4f6; margin-top: 6px; padding-top: 10px; font-weight: 700; color: #111827; }
.summary .line.total .price { font-size: 18px; }

/* ---------- 结算 ---------- */
.addr-box { border: 1px dashed #c7d2fe; background: #f8faff; border-radius: 12px; padding: 12px; }
.addr-box .empty-addr { color: var(--blue); font-weight: 600; font-size: 14px; }
.addr-name { font-weight: 700; font-size: 14px; }
.addr-detail { font-size: 13px; color: #374151; margin-top: 3px; }
.pick-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pick-actions .btn { flex: 1 1 auto; min-width: 96px; }

.phone-ok { color: #027a48; font-weight: 700; font-size: 15px; }
.hint { font-size: 11px; color: #9ca3af; margin-top: 6px; }

.field { display: block; margin-top: 10px; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input[type="text"], input[type="tel"], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, textarea:focus { outline: 2px solid rgba(22, 119, 255, 0.2); border-color: var(--blue); }

.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px;
  max-width: 480px; margin: 0 auto; box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
  border-radius: 16px 16px 0 0;
}
.footer-bar .total { flex: 1; font-size: 13px; }
.footer-bar .total .price { font-size: 20px; }
.footer-bar .btn { width: 150px; }

/* ---------- 订单 ---------- */
.order-card { background: #fff; border-radius: var(--radius); margin: 12px 16px; padding: 14px; cursor: pointer; }
.oc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: #eef4ff; color: var(--blue); font-weight: 600; }
.badge.s0, .badge.s1 { background: #fff4e5; color: #b54708; }
.badge.s2 { background: #eef4ff; color: var(--blue); }
.badge.s3 { background: #e7f6ff; color: #0a6e9c; }
.badge.s4 { background: #e8f8ef; color: #027a48; }
.badge.s5, .badge.s7 { background: #f2f4f7; color: var(--muted); }
.badge.s6 { background: #fef3f2; color: var(--red); }
.oc-lines { margin: 8px 0; }
.oc-line { display: flex; justify-content: space-between; font-size: 13px; color: #374151; padding: 2px 0; }
.oc-foot { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid #f3f4f6; padding-top: 8px; }

.status-hero { padding: 20px 20px 24px; color: #fff; background: linear-gradient(150deg, #1677ff 0%, #0b5ed7 100%); }
.status-hero.s4 { background: linear-gradient(150deg, #12b76a 0%, #027a48 100%); }
.status-hero.s5, .status-hero.s7 { background: linear-gradient(150deg, #9ca3af 0%, #6b7280 100%); }
.status-hero.s6 { background: linear-gradient(150deg, #f79009 0%, #b54708 100%); }
.status-hero h2 { margin: 0; font-size: 20px; }
.status-hero p { margin: 4px 0 0; font-size: 12px; opacity: 0.9; }

.meta-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; gap: 12px; }
.meta-row span:first-child { color: var(--muted); flex: 0 0 auto; }
.meta-row span:last-child { text-align: right; word-break: break-all; }

.empty { text-align: center; color: #9ca3af; font-size: 13px; padding: 48px 0; }

/* ---------- 悬浮购物车 ---------- */
.cartbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px;
  width: calc(100% - 32px); max-width: 448px; height: 52px;
  background: #111827; border-radius: 999px; display: flex; align-items: center;
  padding: 0 6px 0 16px; color: #fff; box-shadow: 0 12px 30px rgba(17, 24, 39, 0.28); z-index: 30;
}
.cart-icon { font-size: 19px; position: relative; }
.cart-count {
  position: absolute; top: -6px; right: -10px; background: var(--red); color: #fff;
  font-size: 10px; min-width: 15px; height: 15px; line-height: 15px; text-align: center;
  border-radius: 999px; padding: 0 3px;
}
.cart-total { flex: 1; text-align: right; font-size: 17px; font-weight: 700; margin-right: 10px; }
.cart-total .sym { font-size: 12px; }
.cart-go {
  border: none; background: var(--blue); color: #fff; font-size: 14px; font-weight: 600;
  padding: 9px 20px; border-radius: 999px; cursor: pointer;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 60;
}
.modal-card {
  background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 82vh; overflow-y: auto; animation: sheet 0.22s ease;
}
@keyframes sheet { from { transform: translateY(24px); opacity: 0.6; } to { transform: translateY(0); opacity: 1; } }
.modal h3 { margin: 0 0 4px; font-size: 16px; }
.pick-item {
  width: 100%; text-align: left; border: 1px solid var(--line); background: #fff;
  border-radius: 12px; padding: 12px; margin-top: 10px; cursor: pointer;
}
.pick-item strong { display: block; font-size: 14px; }
.pick-item em { display: block; font-style: normal; font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }

.pay-sheet .amount { font-size: 30px; font-weight: 800; text-align: center; margin: 8px 0 4px; }
.pay-sheet .pay-way { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid #f3f4f6; font-size: 14px; }
.pay-way .blue { color: var(--blue); font-weight: 700; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%);
  background: rgba(17, 24, 39, 0.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 70; max-width: 86vw; text-align: center;
}

@media (min-width: 520px) {
  .phone { margin-top: 24px; border-radius: 20px; overflow: hidden; min-height: auto; }
  body { padding: 0 12px; }
}
