/* ============================================================
   商城手机端样式（公众号 H5）

   版式对齐参考截图：首页轮播 + 金刚区 + 优惠券卡 + 两列商品瀑布，
   商品详情多图 + 价格条 + 底部操作栏，个人中心红色渐变头 + 订单宫格。
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    margin: 0;
    background: #f5f5f7;
    color: #1c1f26;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

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

.m-wrap { max-width: 480px; margin: 0 auto; background: #f5f5f7; min-height: 100vh; position: relative; }
.m-main { padding-bottom: 70px; }
.m-main.no-tab { padding-bottom: 76px; }

/* 顶栏 */
.m-head {
    position: sticky; top: 0; z-index: 20;
    background: #fff; border-bottom: 1px solid #eee;
    height: 46px; display: flex; align-items: center; justify-content: center;
}
.m-title { font-size: 16px; font-weight: 600; }
.m-back {
    position: absolute; left: 8px; top: 0; height: 46px; line-height: 46px;
    padding: 0 12px; font-size: 24px; color: #333;
}

/* 提示 */
.m-flash { padding: 10px 14px; margin: 10px 12px; border-radius: 10px; font-size: 13px; }
.m-flash-success { background: #e8f6f0; color: #12805c; }
.m-flash-error { background: #fdeceb; color: #c0392b; }
.m-flash-info { background: #eef4ff; color: #1a4bd0; }
.m-flash-warning { background: #fff8e6; color: #b26a00; }

/* 底部导航 */
.m-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    max-width: 480px; margin: 0 auto;
    background: #fff; border-top: 1px solid #eee;
    display: grid; grid-template-columns: repeat(4, 1fr);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.m-tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size:12px; color: #5b6572; }
.m-tabbar a .i { font-size: 18px; line-height: 1; position: relative; }
.m-tabbar a.on { color: var(--primary); }
.m-tabbar .dot {
    position: absolute; top: -6px; right: -12px; background: var(--primary); color: #fff;
    font-size:12px; border-radius: 999px; padding: 0 5px; font-weight: 400;
}

/* 搜索 */
.m-search { padding: 10px 12px; background: #fff; display: flex; align-items: center; gap: 8px; }
.m-search input {
    flex: 1; border: none; background: #f2f3f5; border-radius: 999px;
    padding: 9px 14px; font-size: 13px; color: #1c1f26;
}
.m-search button { border: none; background: none; font-size: 15px; color: #5b6572; }

/* 板块 */
.m-section { background: #fff; margin: 10px 0; padding: 12px; }
.m-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.m-section-head h2 { font-size: 15px; margin: 0; }
.m-more { font-size: 12px; color: #5b6572; }
.m-empty { padding: 40px 16px; text-align: center; color: #9aa1ad; font-size: 13px; }

/* 轮播（用横向滚动 + 吸附代替 swiper） */
.banner-scroll { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px 12px; }
.banner-scroll img, .banner-scroll .ph {
    width: 88%; flex: 0 0 88%; height: 150px; border-radius: 12px; scroll-snap-align: center;
    object-fit: cover; background: #e9ebf0;
}
.banner-scroll .ph {
    display: grid; place-items: center; color: #5b6572; font-size: 13px;
    background: linear-gradient(135deg, #dfe3ea, #eef0f4);
}

/* 金刚区 */
.nav-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 6px; padding: 12px; background: #fff; }
.nav-grid a { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: #4b5563; }
.nav-grid .ic {
    width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    font-size: 20px; background: #fff4f2; color: var(--primary); overflow: hidden;
}
.nav-grid .ic img { width: 100%; height: 100%; object-fit: cover; }

/* 公告条 */
.notice-bar {
    display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: #fff;
    border-top: 1px solid #f2f3f5; font-size: 13px; color: #4b5563;
}
.notice-bar .ic { color: var(--primary); }

/* 优惠券 */
.coupon-card {
    margin: 0 12px 10px; background: #fff; border-radius: 12px; padding: 12px;
    display: flex; gap: 12px; align-items: center; box-shadow: 0 1px 6px rgba(0, 0, 0, .04);
}
.coupon-left { flex: 0 0 76px; text-align: center; color: var(--primary); }
.coupon-left .amt { font-size: 22px; font-weight: 700; }
.coupon-left .amt small { font-size: 12px; }
.coupon-body { flex: 1; min-width: 0; }
.coupon-body .t { font-weight: 600; font-size: 14px; }
.coupon-body .d { font-size: 12px; color: #5b6572; }
.coupon-get {
    background: var(--primary); color: #fff; border: none; border-radius: 999px;
    padding: 6px 14px; font-size: 12px;
}
.coupon-get[disabled] { background: #d9dbe0; }

/* 商品两列瀑布 */
.p-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 10px; }
.p-card { background: #fff; border-radius: 10px; overflow: hidden; }
.p-card .thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #eef0f4; }
.p-card .thumb-ph {
    width: 100%; aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 10px;
    background: linear-gradient(135deg, #f3f4f7, #e8eaef); color: #5b6572; font-size: 12px; text-align: center;
}
.p-card .body { padding: 8px 9px 10px; }
.p-card .t { font-size: 13px; line-height: 1.45; height: 38px; overflow: hidden; }
.p-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { color: var(--primary); font-weight: 600; font-size: 16px; }
.price small { font-size:12px; }
.price-old { color: #5b6572; font-size: 12px; text-decoration: line-through; margin-left: 4px; }
.cart-btn { border: none; background: none; font-size: 17px; color: #4b5563; }

/* 排序条 */
.sort-bar {
    display: flex; align-items: center; gap: 14px; padding: 10px 12px; background: #fff;
    font-size: 13px; color: #4b5563; border-bottom: 1px solid #f2f3f5;
    position: sticky; top: 46px; z-index: 10;
}
.sort-bar a.on { color: var(--primary); font-weight: 600; }
.sort-bar .spacer { flex: 1; }

/* 分类页 */
.cat-wrap { display: flex; min-height: 70vh; }
.cat-side { width: 92px; background: #fafafc; }
.cat-side a { display: block; padding: 14px 8px; font-size: 13px; color: #4b5563; text-align: center; }
.cat-side a.on { background: #fff; color: var(--primary); font-weight: 600; border-left: 3px solid var(--primary); }
.cat-main { flex: 1; background: #fff; padding: 10px; }

/* 商品详情 */
.gallery { display: flex; gap: 6px; overflow-x: auto; background: #fff; }
.gallery img, .gallery .ph {
    flex: 0 0 100%; width: 100%; height: 300px; object-fit: cover; background: #eef0f4;
}
.gallery .ph { display: grid; place-items: center; color: #5b6572; }
.detail-price { background: #fff; padding: 12px; }
.detail-price .row1 { display: flex; align-items: baseline; gap: 8px; }
.detail-price .now { color: var(--primary); font-size: 24px; font-weight: 700; }
.detail-price .now small { font-size: 13px; }
.detail-price .sold { margin-left: auto; font-size: 12px; color: #5b6572; }
.detail-title { padding: 0 12px 10px; background: #fff; font-size: 15px; }
.detail-sub { padding: 0 12px 12px; background: #fff; color: #5b6572; font-size: 12px; }
.detail-coupons { background: #fff; padding: 10px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tag-coupon {
    border: 1px solid #ffd0cc; color: var(--primary); background: #fff6f5;
    border-radius: 6px; font-size: 12px; padding: 3px 8px;
}
.detail-rows { background: #fff; margin-top: 10px; }
.detail-row { display: flex; justify-content: space-between; padding: 12px; border-bottom: 1px solid #f4f5f7; font-size: 13px; }
.detail-row .v { color: #5b6572; }
.detail-tabs { display: flex; gap: 18px; padding: 12px; background: #fff; border-bottom: 1px solid #f2f3f5; font-size: 14px; }
.detail-tabs a.on { color: var(--primary); font-weight: 600; }
.detail-body { background: #fff; padding: 14px; font-size: 14px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.spec-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; background: #fff; border-top: 1px solid #f4f5f7; }
.spec-chip {
    border: 1px solid #e6e8ec; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: #4b5563;
    background: #fff;
}
.spec-chip.on { border-color: var(--primary); color: var(--primary); background: #fff6f5; }

/* 秒杀 */
.seckill-bar {
    display: flex; align-items: center; gap: 10px; padding: 12px; color: #fff;
    background: linear-gradient(90deg, #ff7a45, #d32b22);
}
.seckill-bar .now { font-size: 22px; font-weight: 700; }
.seckill-bar .meta { font-size: 12px; opacity: .95; }
.seckill-bar .clock { margin-left: auto; text-align: right; font-size: 12px; }
.seckill-bar .clock b { font-variant-numeric: tabular-nums; }

/* 底部操作栏 */
.action-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: 480px; margin: 0 auto;
    background: #fff; border-top: 1px solid #eee; display: flex; align-items: center; gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.action-bar .ico { flex: 0 0 52px; text-align: center; font-size:12px; color: #4b5563; }
.action-bar .ico .i { display: block; font-size: 18px; }
.action-bar .btn { flex: 1; border: none; padding: 12px 6px; font-size: 15px; }
.btn-red { background: var(--primary); color: #fff; border: none; border-radius: 0; }
.btn-dark { background: #2b2f3a; color: #fff; border: none; border-radius: 0; }

/* 通用按钮 */
.btn-block-red {
    display: block; width: calc(100% - 24px); margin: 12px; padding: 13px;
    background: var(--primary); color: #fff; border: none; border-radius: 999px; font-size: 15px;
}
.btn-block-line {
    display: block; width: calc(100% - 24px); margin: 12px; padding: 12px;
    background: #fff; color: #4b5563; border: 1px solid #e6e8ec; border-radius: 999px; font-size: 15px;
}
.btn-mini { border: 1px solid #e6e8ec; background: #fff; border-radius: 999px; padding: 5px 14px; font-size: 12px; color: #4b5563; }
.btn-mini.red { border-color: var(--primary); color: var(--primary); }

/* 结算 */
.checkout-addr { background: #fff; padding: 14px 12px; display: flex; gap: 10px; align-items: center; }
.checkout-addr .who { font-weight: 600; }
.checkout-addr .where { font-size: 12px; color: #5b6572; }
.checkout-addr .arrow { margin-left: auto; color: #5b6572; }
.cart-line { display: flex; gap: 10px; padding: 12px; background: #fff; border-bottom: 1px solid #f4f5f7; }
.cart-line .thumb { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; background: #eef0f4; }
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .t { font-size: 13px; line-height: 1.45; }
.cart-line .spec { font-size: 12px; color: #5b6572; }
.cart-line .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 24px; height: 24px; border: 1px solid #e6e8ec; background: #fff; border-radius: 6px; font-size: 14px; line-height: 1; }
.sum-bar {
    background: #fff; padding: 12px; font-size: 13px; display: flex; justify-content: space-between;
    border-bottom: 1px solid #f4f5f7;
}
.sum-bar .k { color: #5b6572; }
.sum-bar .v { color: #1c1f26; }
.sum-bar .v.red { color: var(--primary); font-weight: 600; }

/* 订单 */
.order-tabs { display: flex; background: #fff; border-bottom: 1px solid #f2f3f5; position: sticky; top: 46px; z-index: 10; }
.order-tabs a { flex: 1; text-align: center; padding: 11px 0; font-size: 13px; color: #5b6572; }
.order-tabs a.on { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }
.order-card { background: #fff; margin: 10px 0; padding: 12px; }
.order-card .no { display: flex; justify-content: space-between; font-size: 12px; color: #5b6572; margin-bottom: 10px; }
.order-card .no .st { color: var(--primary); }
.order-item { display: flex; gap: 10px; margin-bottom: 10px; }
.order-item .thumb { width: 68px; height: 68px; border-radius: 8px; object-fit: cover; background: #eef0f4; }
.order-item .t { flex: 1; font-size: 13px; line-height: 1.45; }
.order-item .q { color: #5b6572; font-size: 12px; }
.order-total { text-align: right; font-size: 13px; padding: 6px 0; }
.order-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; border-top: 1px solid #f4f5f7; }

/* 个人中心 */
.mine-head {
    background: linear-gradient(135deg, #ff5b6a, #ff7d6b);
    padding: 20px 16px 34px; color: #fff; position: relative;
}
.mine-head .who { display: flex; align-items: center; gap: 12px; }
.mine-head .avatar { width: 58px; height: 58px; border-radius: 50%; background: rgba(255, 255, 255, .3); object-fit: cover; }
.mine-head .nick { font-size: 17px; font-weight: 600; }
.mine-head .lv { display: inline-block; background: rgba(0, 0, 0, .18); border-radius: 999px; padding: 1px 8px; font-size:12px; margin-right: 6px; }
.mine-head .sign { background: #fff; color: var(--primary); border: none; border-radius: 999px; padding: 3px 12px; font-size: 12px; }
.mine-head .gear { position: absolute; right: 16px; top: 22px; font-size: 18px; color: rgba(255, 255, 255, .9); }
.order-grid {
    background: #fff; border-radius: 12px; margin: -20px 12px 0; padding: 14px 6px;
    display: grid; grid-template-columns: repeat(6, 1fr); text-align: center; position: relative; z-index: 2;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .06);
}
.order-grid a { font-size:12px; color: #4b5563; position: relative; }
.order-grid .i { display: block; font-size: 19px; margin-bottom: 4px; }
.order-grid .dot {
    position: absolute; top: -4px; right: 8px; background: var(--primary); color: #fff;
    font-size:12px; border-radius: 999px; padding: 0 5px;
}
.mine-list { background: #fff; margin: 10px 0; }
.mine-row {
    display: flex; align-items: center; gap: 10px; padding: 14px 12px;
    border-bottom: 1px solid #f4f5f7; font-size: 14px;
}
.mine-row:last-child { border-bottom: none; }
.mine-row .i { width: 24px; text-align: center; }
.mine-row .arrow { margin-left: auto; color: #c8ccd6; }
.mine-row .val { margin-left: auto; color: #5b6572; font-size: 13px; }

/* 统计块 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px; }
.stat-box { background: #fff; border-radius: 10px; padding: 14px; }
.stat-box .k { font-size: 12px; color: #5b6572; }
.stat-box .v { font-size: 19px; font-weight: 600; margin-top: 4px; }

/* 地址 */
.addr-card { background: #fff; padding: 14px 12px; border-bottom: 1px solid #f4f5f7; display: flex; gap: 10px; align-items: flex-start; }
.addr-card .info { flex: 1; }
.addr-card .who { font-weight: 600; }
.addr-card .where { font-size: 12px; color: #5b6572; margin-top: 2px; }
.addr-card .def { color: var(--primary); font-size:12px; border: 1px solid var(--primary); border-radius: 4px; padding: 0 4px; margin-left: 6px; }

/* 登录 */
.login-hero { padding: 36px 20px 20px; text-align: center; }
.login-hero .logo {
    width: 74px; height: 74px; border-radius: 20px; margin: 0 auto 12px; display: grid; place-items: center;
    background: var(--primary); color: #fff; font-size: 30px; font-weight: 700;
}
.login-form { padding: 0 20px; }
.login-form input {
    width: 100%; padding: 13px 14px; border: 1px solid #e6e8ec; border-radius: 10px;
    margin-bottom: 12px; font-size: 15px;
}
.login-form .code-row { display: flex; gap: 10px; }
.login-form .code-row input { flex: 1; }
.login-form .code-row button { flex: 0 0 104px; margin-bottom: 12px; border-radius: 10px; border: 1px solid var(--primary); background: #fff; color: var(--primary); }
.login-note { color: #9aa1ad; font-size: 12px; padding: 0 20px 20px; }

/* 图文内容 */
.article-row { display: flex; gap: 10px; background: #fff; padding: 12px; border-bottom: 1px solid #f4f5f7; }
.article-row .thumb { width: 96px; height: 70px; border-radius: 8px; object-fit: cover; background: #eef0f4; }
.article-row .t { font-size: 14px; }
.article-row .d { font-size: 12px; color: #5b6572; margin-top: 4px; }
