/* ============================================
   一点点超市 H5 样式（移动端优先，360~428px）
   ============================================ */
:root {
    --primary: #e33e3e;
    --primary-dark: #c92f2f;
    --text: #333;
    --text-light: #999;
    --bg: #f6f6f6;
    --card: #fff;
    --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
img { max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: 14px; }

.hide { display: none !important; }

/* 通用头部 */
.h5-header { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--primary); color: #fff; }
.h5-header .hh-logo { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #fff; flex: none; }
.h5-header .hh-logo img { width: 100%; height: 100%; object-fit: cover; }
.h5-header .hh-title { flex: 1; min-width: 0; }
.h5-header .hh-title .t1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h5-header .hh-title .t2 { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h5-header .hh-back { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: none; }
.h5-header .hh-orders { flex: none; background: rgba(255,255,255,.18); color: #fff; border-radius: 14px; padding: 5px 10px; font-size: 12px; }
.ds-imgs { display: flex; gap: 8px; overflow-x: auto; }
.ds-imgs .ds-img { width: 100%; min-width: 100%; height: 240px; object-fit: cover; border-radius: 10px; flex: none; }
.ds-imgs.multi .ds-img { width: 78%; min-width: 78%; }

/* ============ 首页 ============ */
.home-page { background: #fff; }
.hp-header { display: flex; align-items: center; gap: 12px; padding: 20px 16px; background: var(--primary); color: #fff; }
.hp-logo { width: 56px; height: 56px; border-radius: 50%; background: #fff; padding: 4px; object-fit: cover; }
.hp-titles .hp-name { font-size: 20px; font-weight: 700; }
.hp-titles .hp-name-lo { font-size: 13px; opacity: .9; margin-top: 2px; }
.hp-banner { position: relative; overflow: hidden; background: #eee; }
.hp-banner-track { display: flex; transition: transform .4s ease; }
.hp-banner-track img { width: 100%; flex: none; aspect-ratio: 750/400; object-fit: cover; }
.hp-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.hp-dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.6); }
.hp-dots i.on { width: 14px; background: #fff; }
.hp-intro, .hp-cats, .hp-shopinfo { padding: 18px 16px; border-bottom: 8px solid var(--bg); }
.hp-intro h2, .hp-cats h2, .hp-shopinfo h2 { font-size: 16px; margin-bottom: 10px; }
.hp-intro p { color: #666; line-height: 1.7; }
.hp-features { display: flex; gap: 24px; margin-top: 12px; }
.hp-feature { display: flex; align-items: center; gap: 6px; color: var(--primary); font-size: 13px; }
.hp-feature .ic, .hp-cat .ic, .hp-guide-card .ic { font-style: normal; font-family: "Apple Color Emoji","Segoe UI Emoji","Noto Color Emoji",sans-serif; }
.hp-feature .ic-clock::before { content: "🕐"; }
.hp-feature .ic-delivery::before { content: "🚚"; }
.hp-feature .ic-pay::before { content: "💵"; }
.hp-cat .ic-food::before { content: "🍜"; }
.hp-cat .ic-goods::before { content: "🧴"; }
.hp-cat .ic-market::before { content: "🛒"; }
.hp-cat .ic-wholesale::before { content: "📦"; }
.hp-guide-card .ic-qr::before { content: "📱"; }
.hp-cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hp-cat { background: var(--bg); border-radius: var(--radius); padding: 14px 6px; text-align: center; }
.hp-cat .ic { font-size: 24px; display: block; margin-bottom: 6px; line-height: 1.2; }
.hp-cat span { font-size: 12px; }
.hp-info-row { display: flex; padding: 6px 0; border-bottom: 1px dashed #eee; }
.hp-info-row:last-child { border-bottom: none; }
.hp-info-label { width: 76px; color: #999; flex: none; }
.hp-info-row a { color: var(--primary); font-weight: 600; }
.hp-guide { padding: 24px 16px; }
.hp-guide-card { background: var(--bg); border-radius: var(--radius); padding: 24px 20px; text-align: center; }
.hp-guide-card .ic { font-size: 36px; color: var(--primary); }
.hp-guide-card p { margin-top: 10px; }
.hp-guide-sub { font-size: 12px; color: var(--text-light); }
.hp-footer { text-align: center; padding: 18px; color: #aaa; font-size: 12px; }

/* ============ 店铺 ============ */
.shop-body { padding-top: 100px; padding-bottom: 70px; }
/* 搜索栏（吸顶在 header 下方） */
.shop-search { position: sticky; top: 52px; z-index: 90; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card); border-bottom: 1px solid #f0f0f0; }
.shop-search .ss-icon { font-size: 14px; color: var(--text-light); flex: none; }
.shop-search #shop-search-input { flex: 1; height: 34px; border: 1px solid #ececec; border-radius: 17px; background: var(--bg); padding: 0 12px; font-size: 13px; color: var(--text); }
.shop-search #shop-search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.shop-search #shop-search-input:focus { outline: none; border-color: var(--primary); background: var(--card); }
.shop-search .ss-clear { flex: none; width: 22px; height: 22px; border-radius: 50%; background: #e0e0e0; color: #fff; font-size: 12px; line-height: 22px; text-align: center; }
/* 分类横栏 */
.shop-cats { display: flex; overflow-x: auto; background: var(--card); border-bottom: 1px solid #f0f0f0; }
.shop-cats .cat { flex: none; padding: 10px 14px; font-size: 13px; color: #666; position: relative; }
.shop-cats .cat.on { color: var(--primary); font-weight: 600; }
.shop-cats .cat.on::after { content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 20px; height: 3px; background: var(--primary); border-radius: 2px; }
/* 商品列表 */
.goods-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 10px; }
.goods-card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.goods-card .g-img { width: 100%; aspect-ratio: 1/1; object-fit: cover; background: #f0f0f0; display: block; }
.goods-card .g-body { padding: 8px; }
.goods-card .g-title { font-size: 13px; height: 38px; line-height: 19px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.goods-card .g-spec-tip { display: inline-block; margin-top: 4px; border: 1px solid #e3b6b6; color: var(--primary); border-radius: 3px; padding: 1px 5px; font-size: 10px; line-height: 16px; }
.goods-card .g-price { color: var(--primary); font-size: 15px; font-weight: 700; margin-top: 6px; }
.goods-card .g-unit { color: var(--text-light); font-size: 11px; font-weight: 400; margin-left: 2px; }
.goods-card .g-buy { float: right; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 18px; line-height: 28px; text-align: center; }
.goods-card .g-num { float: right; line-height: 28px; color: var(--primary); font-weight: 600; margin: 0 6px; display: none; }
.goods-card .g-num.on { display: inline; }

/* 底部购物车栏 */
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; display: flex; align-items: center; padding: 10px 14px; background: var(--card); box-shadow: 0 -2px 8px rgba(0,0,0,.06); }
.cart-bar .cb-icon { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 20px; display: flex; align-items: center; justify-content: center; }
.cart-bar .cb-badge { position: absolute; top: -4px; right: -6px; background: #ff5722; color: #fff; font-size: 11px; padding: 0 5px; border-radius: 8px; min-width: 16px; text-align: center; }
.cart-bar .cb-total { flex: 1; text-align: right; font-size: 16px; font-weight: 700; color: var(--primary); margin-right: 10px; }
.cart-bar .cb-total small { font-size: 11px; color: var(--text-light); font-weight: 400; }
.cart-bar .cb-btn { background: var(--primary); color: #fff; padding: 9px 22px; border-radius: 20px; font-size: 14px; }

/* 底部导航 */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 95; display: flex; background: var(--card); border-top: 1px solid #f0f0f0; }
.bottom-nav .bn-item { flex: 1; text-align: center; padding: 7px 0 5px; color: #999; font-size: 11px; }
.bottom-nav .bn-item .ic { font-size: 20px; display: block; }
.bottom-nav .bn-item.on { color: var(--primary); }

/* 商品详情弹层 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; }
.detail-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 210; background: #fff; border-radius: 16px 16px 0 0; max-height: 80vh; overflow-y: auto; animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.detail-sheet .ds-body { padding: 16px; }
.detail-sheet .ds-img { width: 100%; height: 240px; object-fit: cover; border-radius: 10px; }
.detail-sheet .ds-title { font-size: 16px; font-weight: 600; margin-top: 10px; }
.detail-sheet .ds-price { color: var(--primary); font-size: 20px; font-weight: 700; margin-top: 6px; }
.detail-sheet .ds-intro { color: #666; font-size: 13px; margin-top: 8px; line-height: 1.7; }
/* 商品规格选择 */
.spec-group { margin-top: 12px; }
.spec-group .sg-title { font-size: 13px; color: #333; font-weight: 600; margin-bottom: 6px; }
.spec-group .sg-title .req { color: var(--primary); margin-left: 3px; }
.spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-options .so-item { border: 1px solid #ddd; border-radius: 16px; padding: 6px 14px; font-size: 13px; color: #555; background: #fff; }
.spec-options .so-item.on { border-color: var(--primary); color: var(--primary); background: #fff5f5; }
/* 购物车/订单商品行内的规格文字 */
.ci-spec { display: block; font-size: 12px; color: #999; margin-top: 2px; }
.oc-goods .og-spec { font-size: 12px; color: #999; }
/* 结算确认中的规格 */
.oc-goods-item { padding: 2px 0; }
.oc-goods-item .og-spec { font-size: 12px; color: #999; }
.detail-sheet .ds-buy { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid #f0f0f0; margin-top: 12px; }
.num-ctrl { display: flex; align-items: center; gap: 12px; }
.num-ctrl .nc-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid #ddd; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.num-ctrl .nc-num { min-width: 30px; text-align: center; font-weight: 600; }

/* 通用按钮 */
.btn-main { background: var(--primary); color: #fff; border-radius: 22px; padding: 10px 28px; font-size: 15px; display: inline-block; }

/* 购物车弹层 */
.cart-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 205; background: #fff; border-radius: 16px 16px 0 0; max-height: 60vh; display: flex; flex-direction: column; animation: slideUp .25s ease; }
.cart-sheet .cs-head { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; font-weight: 600; }
.cart-sheet .cs-list { flex: 1; overflow-y: auto; }
.cart-item { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid #f7f7f7; }
.cart-item .ci-name { flex: 1; font-size: 14px; }
.cart-item .ci-price { color: var(--primary); font-weight: 600; margin-right: 12px; }

/* 页面容器（下单/我的订单/代理中心） */
.page-wrap { padding: 12px; padding-top: 62px; }
.page-card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.page-card h3 { font-size: 15px; margin-bottom: 10px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: #666; margin-bottom: 4px; }
.form-row input, .form-row textarea { width: 100%; border: 1px solid #e0e0e0; border-radius: 8px; padding: 9px 10px; background: #fafafa; }
.form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--primary); background: #fff; }

/* 订单卡片 */
.order-card { background: var(--card); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.order-card .oc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-card .oc-no { font-size: 13px; color: #666; }
.order-card .oc-status { font-size: 13px; }
.order-card .oc-status.pending { color: #f57c00; }
.order-card .oc-status.delivering { color: #1976d2; }
.order-card .oc-status.completed { color: #2e7d32; }
.order-card .oc-status.cancelled { color: #999; }
.order-card .oc-status.refunded { color: var(--primary); }
.order-card .oc-goods { font-size: 13px; color: #555; }
.order-card .oc-total { text-align: right; margin-top: 8px; font-size: 15px; font-weight: 700; color: var(--primary); }

/* 状态时间线 */
.timeline { padding: 4px 0; }
.timeline .tl-item { display: flex; gap: 10px; padding: 6px 0; position: relative; }
.timeline .tl-dot { width: 10px; height: 10px; border-radius: 50%; background: #ccc; margin-top: 5px; flex: none; }
.timeline .tl-item.on .tl-dot { background: var(--primary); }
.timeline .tl-text { flex: 1; }
.timeline .tl-time { color: var(--text-light); font-size: 12px; }

/* ============ 客服浮窗 ============ */
.cs-float { position: fixed; right: 14px; bottom: 86px; z-index: 180; width: 50px; height: 50px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 10px rgba(0,0,0,.25); }
.cs-float img { width: 30px; height: 30px; border-radius: 50%; }
.cs-float .cf-badge { position: absolute; top: -2px; right: -2px; background: #ff5722; color: #fff; font-size: 11px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 8px; padding: 0 4px; }
.cs-panel { position: fixed; left: 0; right: 0; bottom: 0; top: 0; z-index: 300; display: none; }
.cs-panel.open { display: flex; flex-direction: column; background: var(--card); }
.cs-panel .csp-head { display: flex; align-items: center; padding: 12px 14px; background: var(--primary); color: #fff; }
.cs-panel .csp-head .ch-title { flex: 1; font-weight: 600; }
.cs-panel .csp-head button { color: #fff; font-size: 16px; padding: 4px 8px; }
.cs-panel .csp-msgs { flex: 1; overflow-y: auto; padding: 12px; background: #f2f3f5; }
.cs-msg-row { display: flex; margin-bottom: 10px; }
.cs-msg-row.kefu { justify-content: flex-start; }
.cs-msg-row.visitor { justify-content: flex-end; }
.cs-msg-row .cm-bubble { max-width: 72%; padding: 8px 11px; border-radius: 10px; font-size: 14px; word-break: break-all; }
.cs-msg-row.kefu .cm-bubble { background: #fff; }
.cs-msg-row.visitor .cm-bubble { background: #95ec69; }
.cs-msg-row .cm-bubble img { max-width: 160px; max-height: 160px; border-radius: 6px; display: block; }
.cs-msg-row .cm-time { font-size: 11px; color: #bbb; margin: 0 6px; align-self: flex-end; }
.cs-panel .csp-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eee; background: #fff; align-items: flex-end; }
.cs-panel .csp-input textarea { flex: 1; border: 1px solid #e0e0e0; border-radius: 8px; padding: 8px; resize: none; max-height: 80px; }
.cs-panel .csp-input .csp-tools { display: flex; flex-direction: column; gap: 6px; }
.cs-panel .csp-input .csp-tools button { background: #f0f0f0; border-radius: 8px; padding: 6px 10px; font-size: 18px; color: var(--primary); }
.cs-panel .csp-input .csp-send { background: var(--primary); color: #fff; border-radius: 8px; padding: 8px 16px; }

/* ============ 代理中心 ============ */
.agent-tabs { position: fixed; top: 0; left: 0; right: 0; z-index: 100; display: flex; background: var(--primary); color: #fff; padding-top: 8px; }
.agent-tabs .at-tab { flex: 1; text-align: center; padding: 10px 0; font-size: 13px; opacity: .75; }
.agent-tabs .at-tab.on { opacity: 1; font-weight: 700; border-bottom: 3px solid #fff; }
.agent-body { padding: 58px 12px 20px; }
.agent-qr-box { text-align: center; padding: 24px 16px; }
.agent-qr-box img { width: 230px; height: 230px; }
.agent-qr-box .aq-tip { color: var(--text-light); font-size: 12px; margin-top: 8px; }
.agent-link-box { display: flex; gap: 8px; align-items: center; background: var(--card); border-radius: 8px; padding: 10px 12px; margin-top: 14px; }
.agent-link-box .al-url { flex: 1; font-size: 12px; color: #666; word-break: break-all; }
.agent-link-box button { background: var(--primary); color: #fff; border-radius: 6px; padding: 6px 14px; font-size: 12px; flex: none; }
.stat-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 14px; }
.stat-card .sc-label { font-size: 12px; color: var(--text-light); }
.stat-card .sc-value { font-size: 18px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.stat-card .sc-sub { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.chart-box { background: var(--card); border-radius: var(--radius); padding: 12px; }
.chart-box h4 { font-size: 13px; margin-bottom: 8px; }
.range-tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.range-tabs button { flex: none; background: var(--card); border-radius: 16px; padding: 6px 14px; font-size: 12px; color: #666; }
.range-tabs button.on { background: var(--primary); color: #fff; }

/* ============ 登录页 ============ */
.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--primary); }
.login-box { background: #fff; border-radius: 14px; padding: 28px 24px; width: 100%; max-width: 340px; }
.login-box .lb-logo { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: block; object-fit: cover; }
.login-box h2 { text-align: center; font-size: 17px; margin-bottom: 20px; }
.login-box .form-row input { background: #f5f5f5; border: 1px solid transparent; }

/* 提示 */
.toast { position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px; border-radius: 8px; z-index: 999; font-size: 14px; max-width: 80%; }
.empty-tip { text-align: center; color: #aaa; padding: 40px 0; font-size: 13px; }
