/* ============================================================
   工长速配 H5 - 全局样式
   风格：建材行业，简洁、明朗、偏"工长"实用感（不用花哨）
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f5f7;
  color: #1f2329;
  padding-bottom: 64px; /* 给底部 Tab 留空间 */
  max-width: 640px;
  margin: 0 auto;
}
.hidden { display: none !important; }

/* ---------- 头部 ---------- */
.header {
  background: linear-gradient(135deg, #e65100, #ff6d00); /* 建材橙，醒目/接地气 */
  color: #fff;
  padding: 16px 16px 48px;
  border-radius: 0 0 20px 20px;
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: 1px; }
.slogan { font-size: 12px; opacity: .85; margin-top: 4px; }
.search-box {
  display: flex; margin-top: 14px; background: #fff; border-radius: 24px;
  padding: 4px 4px 4px 16px; align-items: center; gap: 8px;
}
.search-box input { flex: 1; border: none; outline: none; font-size: 14px; padding: 8px 0; }
.search-box button {
  background: #e65100; color: #fff; border: none; border-radius: 20px;
  padding: 8px 20px; font-size: 14px; cursor: pointer;
}

/* ---------- 五大类目 ---------- */
.cats {
  display: flex; gap: 8px; padding: 0 12px; margin-top: -28px;
  overflow-x: auto; flex-wrap: wrap; justify-content: center;
}
.cat-card {
  background: #fff; border-radius: 14px; padding: 14px 12px;
  flex: 1 1 30%; max-width: 32%; text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); cursor: pointer;
}
.cat-card .emoji { font-size: 28px; }
.cat-card .cname { font-size: 13px; font-weight: 600; margin-top: 6px; }
.cat-card.active { outline: 2px solid #e65100; }

/* ---------- 商品列表 ---------- */
.section-title { padding: 16px 16px 8px; font-size: 15px; font-weight: 700; color: #333; }
.products { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.product-card {
  background: #fff; border-radius: 12px; padding: 12px;
  display: flex; gap: 12px; align-items: center; box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.product-thumb {
  width: 56px; height: 56px; border-radius: 10px; background: #f0f1f3;
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  flex-shrink: 0; color: #999;
}
.product-info { flex: 1; min-width: 0; }
.product-name { font-size: 15px; font-weight: 600; }
.product-cat { font-size: 11px; color: #ff6d00; background: #fff3ec; padding: 2px 6px; border-radius: 8px; margin-top: 4px; display: inline-block; }
.product-meta { font-size: 12px; color: #888; margin-top: 4px; }
.price { color: #e65100; font-weight: 800; font-size: 16px; }
.price small { font-size: 11px; font-weight: 400; }
.unit { color: #888; font-size: 12px; }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; background: #fff;
  display: flex; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid #ececec; z-index: 50;
}
.tab-item { text-align: center; font-size: 10px; color: #999; cursor: pointer; }
.tab-item.active { color: #e65100; }
.tab-item span { display: block; font-size: 18px; margin-bottom: 2px; }

/* ---------- 悬浮购物车 ---------- */
.cart-fab {
  position: fixed; right: 16px; bottom: 90px; background: #e65100; color: #fff;
  border-radius: 28px; padding: 14px 18px; display: flex; align-items: center; gap: 6px;
  box-shadow: 0 4px 16px rgba(230,81,0,.4); z-index: 60; cursor: pointer; font-size: 15px;
}
.cart-badge {
  position: absolute; top: -8px; right: -8px; background: #f5222d; color: #fff;
  border-radius: 12px; min-width: 20px; height: 20px; text-align: center;
  font-size: 12px; line-height: 20px; padding: 0 4px;
}

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 100; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.modal-body {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto;
  background: #fff; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { font-size: 20px; color: #999; cursor: pointer; }

/* 比价表 */
.sku-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sku-table th, .sku-table td { padding: 8px 6px; text-align: left; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.sku-table th { background: #fafafa; font-weight: 600; color: #666; white-space: nowrap; }
.sku-table .sprice { color: #e65100; font-weight: 700; white-space: nowrap; }
.sku-row { cursor: pointer; }
.sku-row.selected { background: #fff8f4; }
.sku-row .qty { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sku-row .qty button {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid #ddd;
  background: #fff; font-size: 14px; cursor: pointer; line-height: 1;
}
.sku-row .qty input { width: 34px; text-align: center; border: 1px solid #eee; border-radius: 6px; font-size: 13px; padding: 2px; }

/* 按钮 */
.btn {
  display: block; width: 100%; border: none; border-radius: 12px;
  padding: 13px; font-size: 15px; font-weight: 600; cursor: pointer;
  background: #e65100; color: #fff; margin-top: 12px;
}
.btn:disabled { background: #ccc; cursor: not-allowed; }
.btn-gray { background: #f0f0f0; color: #666; }
.btn-line { background: #fff; color: #e65100; border: 1px solid #e65100; }

/* ---------- 订单页 ---------- */
.order-tabs { display: flex; gap: 6px; padding: 12px; overflow-x: auto; }
.order-tabs .ot {
  white-space: nowrap; padding: 6px 14px; border-radius: 16px; background: #fff;
  font-size: 13px; color: #666; cursor: pointer; border: 1px solid #eee;
}
.order-tabs .ot.active { background: #e65100; color: #fff; border-color: #e65100; }
#orders-list { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.order-card { background: #fff; border-radius: 12px; padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.order-card .top { display: flex; justify-content: space-between; font-size: 13px; }
.order-card .ono { color: #999; font-size: 12px; margin-top: 4px; }
.order-card .items { margin-top: 8px; border-top: 1px dashed #eee; padding-top: 8px; font-size: 13px; color: #555; }
.order-card .bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.order-card .amount { color: #e65100; font-weight: 700; }
.status { font-size: 12px; padding: 3px 8px; border-radius: 8px; }
.status-paid { background: #e6f7ff; color: #1890ff; }
.status-delivered { background: #fff7e6; color: #fa8c16; }
.status-received { background: #f6ffed; color: #52c41a; }
.status-pending_payment { background: #fff1f0; color: #f5222d; }

/* ---------- 我的页 ---------- */
.mine-card { margin: 12px; padding: 20px; background: linear-gradient(135deg,#e65100,#ff6d00); color: #fff; border-radius: 14px; }
.mine-menu { margin: 12px; display: flex; flex-direction: column; gap: 10px; }
.menu-item { background: #fff; border-radius: 12px; padding: 14px 16px; font-size: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.05); cursor: pointer; }

/* 空态 */
.empty { text-align: center; color: #aaa; padding: 40px 0; font-size: 14px; }