/* 宇数商城 · 全站样式
   移动端优先：顾客基本用手机扫码下单，桌面端只是把栅格放宽。 */

:root {
    --brand: #185fa5;
    --brand-dark: #124a82;
    --brand-soft: #e8f1fb;
    --bg: #f4f6fa;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #64748b;
    --line: #e6eaf1;
    --danger: #d92d20;
    --ok: #079455;
    --warn: #b54708;
    --radius: 12px;
    /* 统一的尺寸令牌：和后台同名同义，改样式只动这里，
       不会再出现「这个卡片 12px、那个 14px」的散值。 */
    --radius-card: 12px;      /* 卡片、弹窗、二维码框 */
    --radius-ctl: 10px;       /* 按钮、输入框、规格、数量器 */
    --radius-thumb: 10px;     /* 商品缩略图 */
    --radius-chip: 999px;     /* 标签、胶囊、角标 */
    --gap: 16px;              /* 卡片之间、栅格之间的间距 */
    --shadow: 0 1px 3px rgba(16, 30, 54, .06);
    --shadow-lg: 0 8px 24px rgba(16, 30, 54, .1);
    --max: 1180px;
    /* 底部导航栏高度：所有"贴着屏幕底"的东西都要让开这么多，
       否则会被底部导航盖住（曾经就这样盖住过购物车结算栏）。 */
    --tabbar-h: 58px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* 页面竖着铺满一屏：内容不足一屏时把页脚压到最底下，
       否则页脚会悬在半空、下面拖出一大片空白（结算栏/底栏是浮在屏幕上的）。 */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    /* 底部固定条占了多高，就给页面留出同样的空白。
       border-box 下这段 padding 算在 100dvh 之内，只是把最后一行内容顶到浮层上方。 */
    padding-bottom: var(--fixed-bottom);
}

/* 主内容区吃掉剩余高度，把页脚顶到页面底部。
   width:100% 是必须的：flex 项一旦有 margin:auto（.wrap 用来居中）就不再拉伸，
   宽度会缩成内容宽，页面会歪掉。 */
main.wrap { flex: 1 0 auto; width: 100%; }
#appFooter { flex: none; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.hide { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---------- 顶栏 ---------- */
.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 30;
}
.topbar-inner { min-height: 60px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; white-space: nowrap; }
.brand-mark {
    width: 30px; height: 30px; border-radius: var(--radius-ctl); background: var(--brand);
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.topbar-search { flex: 1; display: flex; gap: 8px; }
.topbar-search input {
    flex: 1; min-width: 0; padding: 9px 13px; border: 1px solid var(--line);
    border-radius: var(--radius-chip); background: #f7f9fc; outline: none;
}
.topbar-search input:focus { border-color: var(--brand); background: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    position: relative; display: inline-flex; align-items: center; gap: 5px;
    padding: 8px 12px; border-radius: var(--radius-chip); border: 1px solid var(--line);
    background: #fff; cursor: pointer; white-space: nowrap;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.cart-count {
    background: var(--danger); color: #fff; border-radius: var(--radius-chip);
    font-size: .72rem; padding: 0 6px; min-width: 18px; text-align: center; line-height: 17px;
}

/* ---------- 导航（分类） ---------- */
.navbar { background: var(--card); border-bottom: 1px solid var(--line); }
.navbar-inner { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; }
.navbar-inner a {
    padding: 7px 14px; border-radius: var(--radius-chip); color: var(--muted); white-space: nowrap; font-size: .92rem;
}
.navbar-inner a:hover { background: var(--brand-soft); color: var(--brand); }
.navbar-inner a.active { background: var(--brand); color: #fff; }

/* ---------- 通用块 ---------- */
.card { background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: var(--gap); }
/* ---------- 商品列表：页首 + 工具区 ---------- */
/* 手机端搜索行：顶栏整个隐藏后，搜索入口搬到这里。
   桌面端不显示——那边顶栏里有常驻搜索框。 */
.list-search { display: none; }
@media (max-width: 819px) {
    .list-search {
        display: flex; gap: 8px; margin-bottom: 12px;
    }
    .list-search input {
        flex: 1 1 auto; min-width: 0; padding: 9px 12px; font-size: .92rem;
        border: 1px solid var(--line); border-radius: var(--radius-ctl);
        background: #fff; outline: none; -webkit-appearance: none;
    }
    .list-search input:focus { border-color: var(--brand); }
    .list-search .btn { flex: none; padding: 9px 16px; }
}
/* 页首一行装三样：分类名、结果数量、排序控件。手机上也不折行。 */
.list-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 10px;
}
.list-head-text { min-width: 0; }
.list-title { font-size: 19px; font-weight: 700; margin: 0; line-height: 1.3; }
.list-sub { margin-top: 2px; }

/* 分类标签一行横滑。注意 .filters 默认是 flex-wrap:wrap 且定义在本文件靠后，
   所以这里必须用双类选择器（.list-tools .cate-filters）才压得住，
   否则手机上分类标签会折成两行、把页首撑得很高。 */
.list-tools { margin-bottom: var(--gap); }
.list-tools .cate-filters {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    margin-bottom: 0; padding-bottom: 2px;
}
.list-tools .cate-filters::-webkit-scrollbar { display: none; }
.list-tools .cate-filters .chip { flex: none; }
.sort-control {
    flex: none; display: inline-flex; align-items: center; gap: 6px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-chip);
    padding: 4px 8px 4px 10px; box-shadow: var(--shadow);
}
.sort-control select {
    border: 0; background: transparent; font-size: .88rem; color: var(--text);
    padding: 4px 2px; cursor: pointer; outline: none; max-width: 110px;
}

/* ---------- 首页：主视觉 / 分类入口 / 购物保障 ---------- */
/* 主视觉左边文案、右边卖点；窄屏卖点折到下面。 */
.hero-card {
    background: linear-gradient(120deg, #185fa5, #124a82); color: #fff; border: 0;
    display: grid; gap: 18px; padding: 22px;
}
@media (min-width: 760px) { .hero-card { grid-template-columns: 1.15fr 1fr; padding: 26px; } }
.hero-name { font-size: 22px; font-weight: 700; line-height: 1.4; }
.hero-slogan { opacity: .9; margin-top: 6px; }
.hero-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
/* 主视觉这两个按钮的样式放在下面「按钮」那一节（.btn 之后），
   这里只留占位说明：它们和 .btn 同为单类选择器，写在 .btn 前面会被 .btn 的白底盖掉，
   结果就是白底 + 白字 = 按钮文字看不见。 */
.hero-points { display: grid; gap: 10px; align-content: center; }
@media (min-width: 560px) and (max-width: 759px) { .hero-points { grid-template-columns: repeat(3, 1fr); } }
.hero-point {
    background: rgba(255, 255, 255, .12); border-radius: var(--radius-thumb); padding: 10px 12px;
    display: flex; flex-direction: column; gap: 2px;
}
.hero-point b { font-size: .92rem; }
.hero-point span { font-size: .78rem; opacity: .85; }

/* 分类入口：横向一条，手机上左右滑 */
.cate-strip {
    display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cate-strip::-webkit-scrollbar { display: none; }
.cate-item {
    flex: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-card);
    padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 116px;
    box-shadow: var(--shadow); transition: .15s;
}
.cate-item:hover { border-color: var(--brand); transform: translateY(-2px); }
.cate-name { font-weight: 600; font-size: .92rem; }
.cate-count { color: var(--muted); font-size: .78rem; }

/* 购物保障：整块一张卡，每条一行图标 + 标题 + 说明 */
.promise-card { display: grid; gap: 14px; }
@media (min-width: 760px) { .promise-card { grid-template-columns: 1fr 1fr; } }
.promise-item { display: flex; gap: 10px; align-items: flex-start; }
.promise-icon { font-size: 18px; line-height: 1.3; }
.promise-title { font-weight: 600; font-size: .92rem; }
.promise-text { color: var(--muted); font-size: .82rem; line-height: 1.6; }

.section { margin: 22px 0; }
.section-title { font-size: 18px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .more { margin-left: auto; font-size: .85rem; font-weight: 400; color: var(--muted); }

.notice {
    background: #fff8e6; border: 1px solid #f5dfa6; color: #7a5300;
    border-radius: var(--radius-card); padding: 10px 14px; font-size: .9rem; margin: 14px 0;
    display: flex; gap: 8px; align-items: flex-start;
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: var(--radius-ctl); border: 1px solid var(--line);
    background: #fff; cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f4c6c2; }
.btn-danger:hover { background: #fdf2f1; border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 22px; font-size: 16px; border-radius: var(--radius-ctl); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 主视觉按钮（深蓝底上的一主一次）必须写在 .btn 之后才生效。
   hover 也要一起定，否则 .btn:hover 会把字改成深蓝，在深蓝底上又看不清了。 */
.hero-btn-main { background: #fff; border-color: #fff; color: #124a82; font-weight: 600; }
.hero-btn-main:hover { background: #eef5fd; border-color: #eef5fd; color: #124a82; }
.hero-btn-ghost { background: transparent; border-color: rgba(255, 255, 255, .6); color: #fff; }
.hero-btn-ghost:hover { background: rgba(255, 255, 255, .16); border-color: #fff; color: #fff; }

.badge {
    display: inline-block; padding: 1px 8px; border-radius: var(--radius-chip);
    font-size: .74rem; background: var(--brand-soft); color: var(--brand);
}
.badge-ok { background: #e6f6ee; color: var(--ok); }
.badge-warn { background: #fdf3e6; color: var(--warn); }
.badge-mute { background: #eef1f5; color: var(--muted); }
.badge-danger { background: #fdf0ef; color: var(--danger); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: .88rem; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line);
    border-radius: var(--radius-ctl); background: #fff; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--brand); box-shadow: 0 0 0 3px rgba(24, 95, 165, .1);
}
.field .tip { font-size: .8rem; color: var(--muted); margin-top: 5px; }

/* ---------- 商品 ---------- */
.grid-products {
    display: grid; gap: var(--gap);
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 720px) { .grid-products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .grid-products { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.p-card {
    background: var(--card); border-radius: var(--radius-card); overflow: hidden;
    box-shadow: var(--shadow); transition: .18s; display: flex; flex-direction: column;
}
.p-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.p-card .thumb { background: #f0f3f8; aspect-ratio: 4 / 3; }
.p-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.p-card .body { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.p-card .name { font-weight: 600; font-size: .95rem; line-height: 1.4; }
.p-card .sub { color: var(--muted); font-size: .8rem; min-height: 1.2em; }
.p-card .foot { margin-top: auto; display: flex; align-items: baseline; gap: 6px; padding-top: 6px; }
.price { color: var(--danger); font-weight: 700; }
.price .unit { font-size: .75em; }
.price-old { color: var(--muted); text-decoration: line-through; font-size: .8rem; }
.sold-out { position: relative; }
.sold-out::after {
    content: "缺货"; position: absolute; inset: 0; background: rgba(255, 255, 255, .72);
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-weight: 600;
}

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.chip {
    padding: 6px 13px; border-radius: var(--radius-chip); border: 1px solid var(--line);
    background: #fff; cursor: pointer; font-size: .88rem;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.pager { display: flex; justify-content: center; gap: 8px; margin: 22px 0; }
.pager button { min-width: 40px; }

/* ---------- 详情页 ---------- */
.detail-layout { display: grid; gap: 18px; }
@media (min-width: 860px) { .detail-layout { grid-template-columns: 1.05fr 1fr; align-items: start; } }
.detail-gallery { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow); overflow: hidden; }
.detail-gallery img { width: 100%; }
.thumbs { display: flex; gap: 8px; padding: 10px; overflow-x: auto; }
.thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: var(--radius-thumb); border: 2px solid transparent; cursor: pointer; }
.thumbs img.active { border-color: var(--brand); }
.detail-title { font-size: 21px; font-weight: 700; margin: 0 0 6px; line-height: 1.4; }
.price-box { background: #fff7f6; border-radius: var(--radius-card); padding: 12px 14px; margin: 12px 0; }
.price-box .price { font-size: 26px; }
.spec-list { display: flex; flex-wrap: wrap; gap: 8px; }
.spec {
    padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--radius-ctl);
    background: #fff; cursor: pointer; font-size: .9rem;
}
.spec.active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.spec.disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-ctl); overflow: hidden; }
.qty button { width: 38px; height: 38px; border: 0; background: #fff; cursor: pointer; font-size: 17px; }
.qty button:hover { background: var(--brand-soft); color: var(--brand); }
.qty input { width: 56px; height: 38px; border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); text-align: center; }
.detail-actions { display: flex; gap: 10px; margin-top: 16px; }
.detail-actions .btn { flex: 1; }
/* 底部固定购买栏里的价格：桌面端不显示（桌面价格就在页面上），只在手机底栏出现 */
.detail-bar-price { display: none; }
.rich { line-height: 1.85; }
.rich p { margin: 0 0 12px; }

/* ---------- 购物车 / 结算 ---------- */
/* 三列：勾选框 / 缩略图 / 内容 */
.cart-item {
    display: grid; grid-template-columns: 26px 84px 1fr; gap: 12px; align-items: center;
    padding: 14px 0; border-bottom: 1px solid var(--line);
}
.cart-item:last-child { border-bottom: 0; }
.cart-item .thumb { width: 84px; height: 84px; border-radius: var(--radius-thumb); overflow: hidden; background: #f0f3f8; }
.cart-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item > div { min-width: 0; }                 /* grid 项默认 min-width:auto，会把整行撑出屏幕 */
.cart-item .name { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; }
.cart-item .ops { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; flex-wrap: wrap; }
.cart-item.is-out .thumb img { opacity: .45; }

/* 勾选框：手指点得着（18px 的框 + 26px 的热区），但不喧宾夺主 */
.pick, .pick-all { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pick input, .pick-all input {
    width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--brand);
}
.pick-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.pick-all { gap: 6px; font-size: .92rem; font-weight: 500; }
.summary-bar {
    position: fixed; left: 0; right: 0; z-index: 25;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid var(--line);
    padding: 12px 16px; box-shadow: 0 -2px 10px rgba(16, 30, 54, .06);
}
.summary-bar .wrap-inner {
    max-width: var(--max); margin: 0 auto; width: 100%;
    display: flex; align-items: center; gap: 12px;
}
.summary-bar .total { margin-right: auto; }
.summary-bar .total b { color: var(--danger); font-size: 19px; }
/* 屏幕底部可能被固定的条占掉一段：结算栏 / 详情页购买栏 / 底部导航。
   这段高度由 body 垫出来，页脚不垫。
   —— 之前垫在页脚身上，结果页脚自己拖出 162px 的深色空白，
      而结算栏正好浮在那条空白里，看着就是「合计金额跑到页脚下面去了」。 */
:root { --fixed-bottom: 0px; }
body.has-summary { --fixed-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.amount-lines { display: flex; flex-direction: column; gap: 8px; }
.amount-lines .between { font-size: .92rem; }
.amount-lines .grand { border-top: 1px dashed var(--line); padding-top: 10px; font-size: 16px; }
.amount-lines .grand b { color: var(--danger); font-size: 20px; }

/* ---------- 支付页 ---------- */
.pay-box { max-width: 460px; margin: 24px auto; }
.qr-frame {
    width: 232px; height: 232px; margin: 16px auto; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius-card); padding: 12px;
    display: flex; align-items: center; justify-content: center;
}
.qr-frame canvas, .qr-frame img { width: 100%; height: 100%; }
.pay-amount { font-size: 32px; font-weight: 700; color: var(--danger); text-align: center; }
.steps { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .88rem; margin-top: 14px; }
.status-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.live { background: var(--warn); animation: pulse 1.4s infinite; }
.dot.done { background: var(--ok); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.success-mark {
    width: 62px; height: 62px; border-radius: 50%; background: #e6f6ee; color: var(--ok);
    display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto 12px;
}

/* ---------- 支付页：手机端微信 / 支付宝内付款（扫呗 WAP 收银台） ---------- */
.pay-ways { margin-top: 18px; }
.pay-ways-title { font-size: .9rem; color: var(--muted); margin-bottom: 10px; }
.pay-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 14px; margin-bottom: 10px;
    border: 1px solid var(--line); border-radius: var(--radius-ctl);
    background: #fff; color: var(--text);
    font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.pay-btn:last-child { margin-bottom: 0; }
.pay-btn .pay-ico { font-size: 17px; }
.pay-btn.wechat { background: #07c160; border-color: #07c160; color: #fff; }
.pay-btn.alipay { background: #1677ff; border-color: #1677ff; color: #fff; }
.pay-btn:disabled { opacity: .55; cursor: default; }
.pay-or {
    display: flex; align-items: center; gap: 10px; margin: 18px 0 0;
    color: var(--muted); font-size: .85rem;
}
.pay-or::before, .pay-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.wap-panel {
    margin-top: 12px; padding: 12px 14px; text-align: left;
    background: var(--brand-soft); border-radius: var(--radius-card);
}
.wap-panel .wap-link {
    word-break: break-all; font-size: .78rem; color: var(--muted);
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-ctl);
    padding: 8px 10px; margin: 8px 0; max-height: 84px; overflow: auto;
}
.wap-panel .wap-qr { width: 168px; height: 168px; margin: 10px auto 0; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius-card); padding: 8px;
    display: flex; align-items: center; justify-content: center; }
.wap-panel .wap-qr canvas, .wap-panel .wap-qr img { width: 100%; height: 100%; }
.back-hint {
    margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-card);
    background: #fff8e6; color: var(--warn); font-size: .85rem; text-align: left;
}

/* ---------- 订单 ---------- */
.order-card { background: #fff; border-radius: var(--radius-card); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.order-card .head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: .88rem; }
.order-card .goods { display: flex; gap: 10px; padding: 12px 0; }
.order-card .goods img { width: 58px; height: 58px; border-radius: var(--radius-thumb); object-fit: cover; background: #f0f3f8; }
.order-card .foot { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- 表格 / 列表 ---------- */
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 6px 12px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- 页脚 ---------- */
/* 页脚不需要自己垫高度：底部固定条的空白由 body 统一留（见 --fixed-bottom）。
   垫在页脚身上只会让它多出一长条空白，而悬浮的结算栏正好压在那条空白上。 */
.footer {
    background: #101c30; color: #9fb0c6; margin-top: 34px;
    padding: 26px 0 18px; font-size: .88rem;
}
.footer a { color: #c7d5e6; }
.footer a:hover { color: #fff; }
.footer .cols { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 780px) { .footer .cols { grid-template-columns: 1.2fr 1fr 1fr; } }
.footer h4 { color: #fff; font-size: .95rem; margin: 0 0 8px; }
.footer .links { display: flex; flex-direction: column; gap: 6px; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); margin-top: 20px; padding-top: 16px; text-align: center; font-size: .82rem; }
.police-beian-link { color: inherit; text-decoration: none; }
.police-beian-icon { display: inline-block; height: 1.25em; width: auto; vertical-align: -0.3em; margin-right: .35em; border: 0; }

/* ---------- 手机底部导航（常驻） ----------
   必须是 fixed 而不是 sticky：#appTabbar 容器的高度就等于导航栏自身高度，
   sticky 的"可粘范围"只有它自己那么高，一滚动就跟着内容走了——
   看到的现象就是"底部栏被盖住 / 时有时无"。
   fixed 之后它永远贴在屏幕底部，页面内容由 body.has-tabbar 留出空白。 */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: rgba(255, 255, 255, .97);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); display: flex;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -1px 8px rgba(16, 30, 54, .05);
}
.tabbar a {
    flex: 1; text-align: center; padding: 7px 4px 8px;
    font-size: .76rem; color: var(--muted); line-height: 1.35;
}
.tabbar a.active { color: var(--brand); font-weight: 600; }
.tabbar .tab-icon { font-size: 19px; display: block; line-height: 1.25; }

/* 手机上有底部导航：它是最底下那条，页面要为它留出一格。
   宽屏不显示这条导航（见下），那 --fixed-bottom 就只有结算栏那一段。 */
@media (max-width: 819px) {
    body.has-tabbar { --fixed-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
    body.has-summary { --fixed-bottom: calc(88px + var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
}

/* 电脑/平板横屏不显示手机底部导航：宽屏上方已有完整导航，
   底部这条既占位又和桌面习惯不符。导航一藏，贴着它定位的结算栏要收回去，
   否则会悬空。 */
@media (min-width: 820px) {
    .tabbar { display: none; }
    .summary-bar { bottom: 0; }
}

/* ---------- 提示 ---------- */
#toast {
    position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
    background: rgba(17, 24, 39, .92); color: #fff; padding: 11px 20px; border-radius: var(--radius-ctl);
    z-index: 999; max-width: 86vw; opacity: 0; transition: .2s; pointer-events: none;
}
#toast.show { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }
/* 空状态固定两层：主文案说"怎么了"，提示说"下一步怎么办"，操作按钮统一居中。 */
.empty .empty-title { font-size: .95rem; color: var(--text); margin-bottom: 4px; }
.empty .empty-hint { font-size: .82rem; }
.empty .empty-actions { margin-top: 14px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.skeleton { background: linear-gradient(90deg, #eef1f6, #f7f9fc, #eef1f6); border-radius: var(--radius-ctl); height: 14px; }

/* ---------- 顶栏：搜索入口 / 我的菜单 ---------- */

/* 桌面：hover 展开；手机：点箭头展开（用 .open 控制，避免手机没有 hover） */
.account-menu { position: relative; display: inline-flex; align-items: center; }
.caret-btn {
    border: 0; background: none; cursor: pointer; color: var(--muted);
    font-size: 11px; line-height: 1; padding: 4px 2px; margin-left: -2px;
}
.caret-btn:hover { color: var(--brand); }
.account-drop {
    display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
    min-width: 168px; padding: 6px; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius-card); box-shadow: var(--shadow-lg);
}
.account-menu:hover .account-drop,
.account-menu.open .account-drop { display: block; }
.account-drop a,
.account-drop button {
    display: block; width: 100%; text-align: left; padding: 8px 10px;
    border: 0; background: none; border-radius: var(--radius-ctl); cursor: pointer;
    font-size: .9rem; color: var(--text); white-space: nowrap;
}
.account-drop a:hover,
.account-drop button:hover { background: var(--brand-soft); }
.account-drop button { color: var(--danger); }

/* 手机端搜索：默认收起，点顶栏放大镜展开 */
.search-toggle { display: none; }
.mobile-search { display: none; border-top: 1px solid var(--line); background: var(--card); }
.mobile-search.open { display: block; }
.mobile-search .wrap { display: flex; gap: 8px; padding: 10px 0; }
.mobile-search input { flex: 1; min-width: 0; }

/* 账号按钮的“长标签 / 短标签”：宽屏显示手机号，窄屏退化成“我的” */
.lbl-short { display: none; }

/* 顶栏按钮在中小屏都会挤（实测 390px 溢出到 506、768px 溢出到 793）：
   900px 以下只留图标，账号用短标签；640px 以下连搜索框也收起来。
   注意别把这里的断点调小——标签文字会被 min-content 撑住、不会自动缩。 */
/* 超窄屏（小屏手机 360px 以下）实在放不下：品牌只留方块徽标 */
@media (max-width: 400px) {
    .brand-name { display: none; }
}

@media (max-width: 900px) {
    .topbar-actions { gap: 6px; }
    .icon-btn { padding: 7px 10px; }
    .topbar-actions .lbl { display: none; }
    .topbar-actions .icon-btn.account .lbl-short { display: inline; }
}

@media (max-width: 640px) {
    .topbar-search { display: none; }
    .search-toggle { display: inline-flex; }
    .topbar-inner { min-height: 54px; }
    /* 详情页底部固定购买栏：价格 + 加入购物车/立即购买，
       整条贴着底部导航上方，页面正文留出同样高度才不会被盖住。 */
    .detail-actions {
        position: fixed; left: 0; right: 0; z-index: 25;
        bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
        margin: 0; padding: 10px 16px; gap: 8px; align-items: center;
        background: #fff; border-top: 1px solid var(--line);
        box-shadow: 0 -2px 10px rgba(16, 30, 54, .06);
    }
    .detail-actions .btn { flex: 0 1 auto; padding: 10px 14px; font-size: .9rem; }
    .detail-bar-price {
        display: flex; flex-direction: column; margin-right: auto; min-width: 0;
        line-height: 1.25;
    }
    .detail-bar-price .price { font-size: 19px; }
    .detail-bar-price .unit { font-size: 13px; }
    .detail-bar-stock { font-size: .72rem; color: var(--muted); white-space: nowrap; }
    body[data-page="detail"] { padding-bottom: calc(78px + var(--fixed-bottom)); }
}

/* 宽屏有常驻搜索框，手机那行搜索永远不出现（防止旋转屏幕后残留在页面上） */
@media (min-width: 641px) {
    .mobile-search { display: none !important; }
}

/* ---------- 登录 / 注册 ---------- */
.auth-section { display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; padding: 22px 20px; }

.auth-tabs {
    display: flex; gap: 4px; background: var(--bg);
    border-radius: var(--radius-ctl); padding: 4px; margin-bottom: 20px;
}
.auth-tab {
    flex: 1; border: 0; background: none; cursor: pointer;
    padding: 9px 10px; border-radius: var(--radius-ctl);
    font-size: .95rem; color: var(--muted); font-family: inherit;
}
.auth-tab.active { background: #fff; color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }

/* 图形验证码：输入框 + 可点击刷新的图片 */
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; letter-spacing: 2px; }
.captcha-img {
    width: 116px; height: 42px; flex: none; cursor: pointer;
    border: 1px solid var(--line); border-radius: var(--radius-thumb); background: #f6f9fd;
    object-fit: cover; display: block;
}
.captcha-img.loading { opacity: .45; }

@media (max-width: 420px) {
    .captcha-img { width: 104px; height: 38px; }
}

/* ---------- 其他登录方式（短信 / 微信，启用后才显示） ---------- */
.alt-login { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 16px; }
.alt-login .alt-title { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 12px; }
.alt-login .btn + .btn { margin-top: 10px; }
.btn-wechat { background: #07c160; border-color: #07c160; color: #fff; }
.btn-wechat:hover { background: #06ad56; }
.alt-hint { font-size: .8rem; color: var(--muted); margin-top: 8px; text-align: center; }
.sms-row { display: flex; gap: 10px; align-items: stretch; }
.sms-row input { flex: 1; min-width: 0; }
.sms-row .btn { flex: none; }

/* ---------- 账号页信息 ---------- */
.account-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.account-head .who { font-size: 17px; font-weight: 600; }
.badge-line { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* 窄屏把数量控件收窄，否则"数量 + 删除"会顶出屏幕（实测 390px 溢出 11px） */
@media (max-width: 420px) {
    .qty button { width: 32px; height: 36px; }
    .qty input { width: 44px; height: 36px; }
}

/* ---------- 「我的」：像淘宝那样把功能摆成方块按钮 ----------
   订单入口、服务入口都用同一种方块，一眼看清有哪些能点；
   「收货地址」也从藏在卡片角落的小按钮，改成一个正常的入口按钮
   （改密码同理）——点开就在下面展开表单，不用满页面找。 */
.me-card { display: flex; align-items: center; gap: 14px; }
.me-avatar {
    width: 52px; height: 52px; flex: none; border-radius: 50%;
    background: var(--brand-soft); color: var(--brand);
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.me-info { min-width: 0; flex: 1; }
.me-info .who { font-size: 17px; font-weight: 600; }
.entry-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px;
}
.entry-head .more-link { font-size: .85rem; color: var(--muted); }
.entry-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.entry-grid + .entry-grid { margin-top: 8px; }
/* 「我的」里的方块入口：<a> 和 <button> 共用一套，两种写法看起来一模一样 */
.entry {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 11px 4px; border: 1px solid var(--line); border-radius: var(--radius-ctl);
    background: #fff; cursor: pointer; font-family: inherit; font-size: .8rem;
    color: var(--text); line-height: 1.3; text-align: center;
}
.entry:hover { border-color: var(--brand); color: var(--brand); }
.entry .entry-icon { font-size: 19px; }
.entry .entry-count {
    position: absolute; top: 3px; right: 5px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: var(--radius-chip); background: var(--danger); color: #fff;
    font-size: .68rem; line-height: 16px; text-align: center;
}
.entry-panel { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.entry-panel .field:last-of-type { margin-bottom: 12px; }

/* ==========================================================
   结算：配送方式 + 收货地址
   两块都用「大号可点卡片」而不是下拉框——手机上手指好点，
   一眼也能看出选的是哪种、寄到哪。
   ========================================================== */

.ship-ways { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .ship-ways { grid-template-columns: 1fr 1fr; } }
.ship-way {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-ctl);
    background: #fff; transition: border-color .15s, background .15s;
}
.ship-way:hover { border-color: var(--brand); }
.ship-way input { position: absolute; opacity: 0; pointer-events: none; }
.ship-way .sw-icon { font-size: 20px; line-height: 1.2; }
.ship-way .sw-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ship-way .sw-body b { font-size: .95rem; }
.ship-way .sw-body small { color: var(--muted); font-size: .8rem; line-height: 1.4; }
.ship-way .sw-tick {
    align-self: center; width: 20px; height: 20px; flex: none; border-radius: 50%;
    border: 1px solid var(--line); color: transparent; background: #fff;
    font-size: 12px; line-height: 18px; text-align: center;
}
.ship-way.active { border-color: var(--brand); background: var(--brand-soft); }
.ship-way.active .sw-tick { background: var(--brand); border-color: var(--brand); color: #fff; }

.addr-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.addr-item {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-ctl);
    background: #fff;
}
.addr-item input[type=radio] { margin-top: 2px; flex: none; }
.addr-item .ai-body { flex: 1; min-width: 0; }
.addr-item .ai-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.addr-item .ai-phone { color: var(--muted); font-size: .88rem; }
.addr-item .ai-addr { display: block; margin-top: 3px; color: var(--muted); font-size: .82rem; line-height: 1.5; overflow-wrap: anywhere; }
.addr-item .ai-ops { flex: none; display: flex; flex-direction: column; gap: 4px; }
.addr-item.selected { border-color: var(--brand); background: var(--brand-soft); }
.addr-item.selected .ai-addr { color: var(--text); }

.link-btn {
    border: 0; background: none; padding: 0; font: inherit; font-size: .8rem;
    color: var(--brand); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.link-btn.disabled { color: var(--muted); cursor: default; text-decoration: none; }

.addr-form { border-top: 1px dashed var(--line); padding-top: 14px; }
.chk-line { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; cursor: pointer; }
.chk-line input { width: auto; }

.badge-soft { background: var(--brand-soft); color: var(--brand); }

/* 手机再收紧一档：地址行里的编辑/删除改成横向排列，省出来的宽度给地址正文 */
@media (max-width: 520px) {
    .addr-item { padding: 10px; gap: 8px; }
    .addr-item .ai-ops { flex-direction: row; gap: 10px; align-self: flex-end; }
    .ship-way { padding: 10px 12px; }
}

/* ==========================================================
   手机端收口
   全部关于"手机上要更紧凑 / 少显示"的规则集中在这里。
   刻意放在文件最后：同为单类选择器时后写的生效，
   这样就不用满文件写 !important。
   ========================================================== */

/* 手机端顶部整条不显示：不要 logo、也不要搜索框。
   这两样在手机上性价比最低——logo 占掉一屏里最宝贵的第一行，
   搜索框点了还要唤起键盘；而底部导航已经有「分类」，
   搜索就放在分类页页首（.list-search），离商品列表最近。
   顶部分类条（.navbar）同理一并隐藏，避免和页内的分类筛选重复。 */
@media (max-width: 819px) {
    .topbar { display: none; }
    .navbar { display: none; }
}

/* 整体收紧一档：手机上先看到内容，而不是各种留白 */
@media (max-width: 640px) {
    :root {
        --gap: 12px;          /* 卡片之间、栅格之间 */
        --radius-card: 10px;  /* 卡片圆角也跟着小一点，不然显得笨 */
    }
    body { font-size: 14px; }
    .wrap { padding: 0 12px; }
    .card { padding: 14px; }
    .section { margin: 14px 0; }
    .section-title { font-size: 16px; margin-bottom: 10px; }
    .hero-card { padding: 16px; gap: 12px; }
    .hero-name { font-size: 19px; }
    .hero-actions { margin-top: 12px; }
    .p-card .body { padding: 10px; }
    .p-card .name { font-size: .9rem; }
    .list-title { font-size: 17px; }
    .notice { margin: 10px 0; padding: 9px 12px; }
    .pager { margin: 16px 0; }
    .field { margin-bottom: 12px; }
    .field input, .field textarea, .field select { padding: 10px 12px; }

    /* 购物车：缩略图小一圈，一屏能装下更多行 */
    .cart-item { grid-template-columns: 24px 68px 1fr; gap: 10px; padding: 11px 0; }
    .cart-item .thumb { width: 68px; height: 68px; }
    .cart-item .ops { margin-top: 6px; }

    /* 结算栏窄一点，别把正文挤没了 */
    .summary-bar { padding: 10px 12px; }
    .summary-bar .total b { font-size: 17px; }
}

/* 页脚：手机端只留一行版权和备案号（必须有，是备案要求）。
   客服电话、配送/退换货这些入口已经在「我的 → 设置与帮助」里，页脚不再重复罗列。 */
@media (max-width: 819px) {
    /* 手机端这条深色页脚只在【首页】出现。
       二级页（详情 / 列表 / 购物车 / 我的 / 订单…）底部已经有一条底部导航栏，
       再压一条黑块显得很重，也没人看。备案号要求展示在"网站首页底部"，首页保留就够。 */
    body:not([data-page="home"]) .footer { display: none; }
    .footer { margin-top: 18px; padding: 12px 0; font-size: .8rem; }
    .footer .cols { display: none; }
    .footer-bottom {
        margin-top: 0; padding-top: 0; border-top: 0;
        font-size: .72rem; line-height: 1.5; text-align: center;
    }
}

/* 更窄的小屏：功能入口再收一点，保证一行四个还能点得准 */
@media (max-width: 380px) {
    .entry-grid { gap: 6px; }
    .entry { padding: 9px 2px; font-size: .75rem; }
    .entry .entry-icon { font-size: 17px; }
}
