/* 极简商城 H5 样式
 * 移动端优先，宽度 < 750px
 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: #333; background: #f5f5f5; font-size: 14px; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; outline: none; }

/* 顶部导航 */
.topbar { position: sticky; top: 0; z-index: 10; background: #fff; padding: 10px 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.topbar .logo { font-weight: bold; font-size: 17px; color: #ff5a1f; }
.topbar .search { flex: 1; background: #f2f2f2; border-radius: 18px; padding: 6px 14px; font-size: 13px; color: #999; border: none; }
.topbar .nav-btn { padding: 4px 10px; font-size: 13px; color: #666; }

/* 底部 Tab */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: #fff; display: flex; border-top: 1px solid #eee; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; text-align: center; padding: 8px 0 6px; color: #888; font-size: 11px; }
.tabbar a.on { color: #ff5a1f; }
.tabbar a .ico { display: block; font-size: 20px; margin-bottom: 2px; }

/* 容器 */
.page { padding: 12px; padding-bottom: 70px; max-width: 750px; margin: 0 auto; }
.page-title { font-size: 16px; font-weight: bold; margin: 6px 2px 10px; }

/* 商品卡片 */
.goods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.goods-card { background: #fff; border-radius: 8px; overflow: hidden; }
.goods-card .cover { aspect-ratio: 1 / 1; background: #f0f0f0; }
.goods-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.goods-card .info { padding: 8px 10px 10px; }
.goods-card .name { font-size: 13px; line-height: 1.3; height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.goods-card .price-row { margin-top: 4px; display: flex; align-items: baseline; justify-content: space-between; }
.goods-card .price { color: #ff5a1f; font-weight: bold; font-size: 16px; }
.goods-card .price::before { content: '¥'; font-size: 12px; }
.goods-card .origin { color: #bbb; font-size: 11px; text-decoration: line-through; margin-left: 4px; }
.goods-card .tag { font-size: 11px; color: #ff5a1f; border: 1px solid #ff5a1f; border-radius: 3px; padding: 1px 5px; }

/* 按钮 */
.btn { display: inline-block; padding: 10px 16px; border-radius: 22px; background: #ff5a1f; color: #fff; text-align: center; border: none; cursor: pointer; font-size: 14px; }
.btn.gray { background: #eee; color: #666; }
.btn.block { display: block; width: 100%; border-radius: 12px; padding: 12px; }
.btn.sm { padding: 5px 12px; font-size: 12px; border-radius: 14px; }
.btn[disabled] { opacity: .5; }

/* 标签 */
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; }
.tag-red { background: #fff0e8; color: #ff5a1f; }
.tag-blue { background: #e6f0ff; color: #3b82f6; }
.tag-gray { background: #eee; color: #666; }
.tag-green { background: #e8f9ef; color: #16a34a; }
.tag-yellow { background: #fffbeb; color: #ca8a04; }

/* 卡片 */
.card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: #bbb; font-size: 13px; }
.empty .emo { font-size: 40px; margin-bottom: 10px; }

/* 表单 */
.form-row { display: flex; align-items: center; padding: 12px; border-bottom: 1px solid #f0f0f0; background: #fff; }
.form-row:last-child { border-bottom: none; }
.form-row label { width: 80px; color: #666; font-size: 13px; }
.form-row input, .form-row select { flex: 1; border: none; font-size: 14px; padding: 4px 0; background: transparent; }

/* 弹窗 */
.mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; display: flex; align-items: center; justify-content: center; }
.dialog { width: 85%; max-width: 380px; background: #fff; border-radius: 12px; overflow: hidden; }
.dialog .d-hd { padding: 14px; font-size: 15px; font-weight: bold; border-bottom: 1px solid #f0f0f0; text-align: center; }
.dialog .d-bd { padding: 14px; max-height: 60vh; overflow: auto; }
.dialog .d-ft { display: flex; border-top: 1px solid #f0f0f0; }
.dialog .d-ft button { flex: 1; padding: 12px; border: none; background: #fff; font-size: 14px; }
.dialog .d-ft button.primary { color: #ff5a1f; font-weight: bold; }

/* 数量选择器 */
.qty-box { display: inline-flex; align-items: center; border: 1px solid #ddd; border-radius: 4px; overflow: hidden; }
.qty-box button { width: 28px; height: 28px; background: #f8f8f8; border: none; font-size: 16px; }
.qty-box .n { min-width: 32px; text-align: center; font-size: 13px; }

/* 详情页 */
.detail .cover { width: 100%; background: #f0f0f0; }
.detail .cover img { width: 100%; }
.detail .price-bar { background: #fff; padding: 14px; display: flex; align-items: baseline; gap: 10px; }
.detail .price-bar .price { color: #ff5a1f; font-size: 22px; font-weight: bold; }
.detail .price-bar .origin { color: #bbb; font-size: 12px; text-decoration: line-through; }
.detail .detail-name { padding: 10px 14px 0; font-size: 16px; font-weight: bold; background: #fff; }
.detail .detail-desc { padding: 10px 14px 14px; color: #888; font-size: 13px; background: #fff; white-space: pre-wrap; }
.detail .fixed-bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; display: flex; padding: 8px 10px; gap: 10px; border-top: 1px solid #eee; z-index: 20; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.detail .fixed-bar .btn { flex: 1; }

/* 购物车 */
.cart-item { display: flex; gap: 10px; padding: 10px; background: #fff; border-radius: 10px; margin-bottom: 8px; }
.cart-item .cover { width: 80px; height: 80px; background: #f0f0f0; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.cart-item .cover img { width: 100%; height: 100%; object-fit: cover; }
.cart-item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.cart-item .info .name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item .info .bottom { display: flex; justify-content: space-between; align-items: center; }
.cart-item .info .price { color: #ff5a1f; font-weight: bold; }

/* 结算页 ship_type 二选一 */
.ship-type { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ship-type .opt { border: 2px solid #eee; border-radius: 10px; padding: 14px 10px; text-align: center; background: #fff; transition: all .15s; }
.ship-type .opt.active { border-color: #ff5a1f; background: #fff7f2; }
.ship-type .opt .emoji { font-size: 24px; margin-bottom: 6px; }
.ship-type .opt .title { font-weight: bold; font-size: 14px; }
.ship-type .opt .sub { font-size: 12px; color: #888; margin-top: 4px; }

/* 订单列表 */
.order-card { background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.order-card .oh { display: flex; justify-content: space-between; font-size: 12px; color: #999; padding-bottom: 8px; border-bottom: 1px dashed #f0f0f0; }
.order-card .os { font-weight: bold; }
.order-card .os.pending { color: #ff5a1f; }
.order-card .os.paid, .order-card .os.storage_ok { color: #3b82f6; }
.order-card .os.shipped { color: #16a34a; }
.order-card .os.cancelled, .order-card .os.expired { color: #999; }
.order-card .body { display: flex; gap: 10px; padding: 10px 0; }
.order-card .body .cover { width: 60px; height: 60px; background: #f0f0f0; border-radius: 6px; overflow: hidden; flex-shrink: 0; }
.order-card .body .info { flex: 1; min-width: 0; }
.order-card .body .info .n { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-card .body .info .p { color: #ff5a1f; font-size: 13px; }
.order-card .body .info .q { color: #999; font-size: 12px; float: right; }
.order-card .foot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px dashed #f0f0f0; }
.order-card .foot .total { font-size: 12px; color: #666; }
.order-card .foot .total b { color: #ff5a1f; font-size: 16px; }

/* 付款二维码页 */
.pay-wrap { text-align: center; padding: 30px 20px; }
.pay-wrap .amt { font-size: 28px; color: #ff5a1f; font-weight: bold; margin: 10px 0; }
.pay-wrap .qr { width: 220px; height: 220px; background: #fff; border: 1px solid #eee; border-radius: 10px; margin: 20px auto 10px; padding: 10px; }
.pay-wrap .qr img { width: 100%; height: 100%; object-fit: contain; }
.pay-wrap .qr-placeholder { color: #bbb; font-size: 12px; line-height: 1.6; padding: 50px 10px; }
.pay-wrap .switch { display: inline-flex; background: #f0f0f0; border-radius: 20px; padding: 3px; }
.pay-wrap .switch button { padding: 6px 16px; border-radius: 17px; border: none; background: transparent; font-size: 13px; }
.pay-wrap .switch button.on { background: #fff; color: #ff5a1f; font-weight: bold; }
.pay-wrap .remark { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 10px; margin: 16px auto; max-width: 280px; font-size: 13px; color: #92400e; }
.pay-wrap .copy { color: #3b82f6; text-decoration: underline; font-size: 12px; margin-top: 6px; }

/* 会员中心 */
.member-hero { background: linear-gradient(135deg, #ff8a4d, #ff5a1f); color: #fff; padding: 20px 14px; border-radius: 0 0 18px 18px; }
.member-hero .top { display: flex; align-items: center; gap: 12px; }
.member-hero .avatar { width: 50px; height: 50px; background: rgba(255,255,255,.25); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.member-hero .nick { font-size: 16px; font-weight: bold; }
.member-hero .phone { font-size: 12px; opacity: .8; }
.member-hero .points-bar { margin-top: 14px; background: rgba(255,255,255,.18); border-radius: 10px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; }
.member-hero .points-bar .v { font-size: 22px; font-weight: bold; }
.member-hero .points-bar .lbl { font-size: 12px; opacity: .9; }

/* 积分流水 */
.point-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f5f5f5; }
.point-item:last-child { border-bottom: none; }
.point-item .t { font-size: 13px; }
.point-item .sub { font-size: 11px; color: #aaa; margin-top: 2px; }
.point-item .v { font-weight: bold; }
.point-item .v.plus { color: #16a34a; }
.point-item .v.minus { color: #ff5a1f; }

/* admin 侧边 */
.admin-body { padding: 0; background: #f5f5f5; }
.admin-layout { display: flex; }
.admin-side { width: 160px; min-height: 100vh; background: #1f2937; color: #d1d5db; padding-top: 20px; flex-shrink: 0; }
.admin-side .logo { padding: 0 16px 20px; font-size: 16px; font-weight: bold; color: #fff; border-bottom: 1px solid #374151; }
.admin-side a { display: block; padding: 11px 16px; font-size: 14px; border-left: 3px solid transparent; }
.admin-side a.on { background: #111827; border-left-color: #ff5a1f; color: #fff; }
.admin-main { flex: 1; padding: 18px; min-width: 0; }
.admin-main h2 { margin: 0 0 14px; font-size: 18px; }
.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; font-size: 13px; }
.admin-table th, .admin-table td { padding: 9px 10px; border-bottom: 1px solid #f0f0f0; text-align: left; }
.admin-table th { background: #fafafa; color: #666; font-weight: 600; }
.admin-table tr:hover td { background: #fff8f3; }
.admin-toolbar { margin-bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-toolbar input, .admin-toolbar select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }

/* 后台表单：输入框可见化（默认白底无边框导致看不出可输入） */
.admin-body .form-row { align-items: flex-start; gap: 14px; padding: 12px 14px; }
.admin-body .form-row > label { width: 96px; flex-shrink: 0; padding-top: 9px; color: #555; font-size: 13px; line-height: 1.5; }
.admin-body .form-row input[type="text"],
.admin-body .form-row input[type="number"],
.admin-body .form-row input[type="password"],
.admin-body .form-row input:not([type]),
.admin-body .form-row select,
.admin-body .form-row textarea {
    flex: 1; min-width: 0; padding: 9px 11px; font-size: 14px; color: #333;
    background: #fff; border: 1px solid #dcdcdc; border-radius: 6px;
    transition: border-color .15s, box-shadow .15s;
}
.admin-body .form-row input:focus,
.admin-body .form-row select:focus,
.admin-body .form-row textarea:focus {
    border-color: #ff5a1f; box-shadow: 0 0 0 3px rgba(255,90,31,.12);
}
.admin-body .form-row input::placeholder { color: #bbb; }

/* 系统配置页 */
.cfg-section { background: #fff; border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; }
.cfg-section h3 { margin: 0 0 4px; font-size: 15px; color: #333; }
.cfg-section .cfg-tip { margin: 0 0 14px; font-size: 12px; color: #999; line-height: 1.7; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.cfg-item { background: #fcfcfc; border: 1px solid #efefef; border-radius: 8px; padding: 12px 14px 14px; }
.cfg-item .cfg-name { font-size: 13px; font-weight: 600; color: #333; }
.cfg-item .cfg-desc { font-size: 12px; color: #999; line-height: 1.6; margin: 4px 0 10px; }
.cfg-field { display: flex; align-items: center; gap: 8px; }
.cfg-field input { flex: 1; min-width: 0; padding: 9px 11px; font-size: 14px; color: #333; background: #fff; border: 1px solid #dcdcdc; border-radius: 6px; transition: border-color .15s, box-shadow .15s; }
.cfg-field input:focus { border-color: #ff5a1f; box-shadow: 0 0 0 3px rgba(255,90,31,.12); }
.cfg-field .unit { flex-shrink: 0; font-size: 13px; color: #888; }

/* 后台收款二维码上传 */
.cfg-field.qr-field { flex-wrap: wrap; align-items: flex-start; }
.cfg-field .qr-preview { width: 104px; height: 104px; border: 1px dashed #ddd; border-radius: 8px; background: #fafafa; display: flex; align-items: center; justify-content: center; overflow: hidden; color: #aaa; font-size: 12px; }
.cfg-field .qr-preview img { width: 100%; height: 100%; object-fit: contain; }
.cfg-actions { margin-top: 4px; }

/* 响应式：小屏后台 */
@media (max-width: 640px) {
    .admin-layout { flex-direction: column; }
    .admin-side { width: 100%; min-height: auto; display: flex; overflow-x: auto; padding-top: 0; }
    .admin-side .logo { border-bottom: none; border-right: 1px solid #374151; padding: 0 14px; line-height: 45px; }
    .admin-side a { border-left: none; border-top: 3px solid transparent; padding: 0 12px; line-height: 45px; white-space: nowrap; }
    .admin-side a.on { border-top-color: #ff5a1f; border-left-color: transparent; }
    .admin-table { font-size: 12px; }
    .admin-table th, .admin-table td { padding: 6px; }
}
