/* 安居链 H5 设计系统 — 移动优先(协会联盟蓝) */
:root {
  --primary: #1f5eff;
  --primary-dark: #0f3fc4;
  --primary-light: #4d84ff;
  --primary-deep: #0a2f9e;
  --accent: #ff8f1f;
  --gold: #d4a017;
  --red: #e8442e;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-2: #666666;
  --text-3: #999999;
  --line: #eeeeee;
  --green: #07a35c;
  --blue: #2471a3;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(15,63,196,.07);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5;
}
.page { max-width: 750px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: calc(64px + var(--safe-bottom)); }
.page.no-tab { padding-bottom: calc(20px + var(--safe-bottom)); }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* ---------- 顶部导航 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 12px; background: var(--primary); color: #fff;
}
.navbar.white { background: #fff; color: var(--text); border-bottom: 1px solid var(--line); }
.navbar .back { font-size: 34px; width: 40px; cursor: pointer; font-weight: 600; line-height: 1; padding-bottom: 4px; }
.navbar .title { flex: 1; text-align: center; font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navbar .right { width: 40px; font-size: 14px; text-align: right; }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 750px; z-index: 100;
  display: flex; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; color: var(--text-3); font-size: 13px; }
.tabbar a .ico { line-height: 0; margin-bottom: 3px; }
.tabbar a .ico svg { width: 24px; height: 24px; display: block; }
.tabbar a.active { color: var(--primary); }
.tabbar .badge { position: absolute; margin-left: 22px; margin-top: -4px; background: var(--primary); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 14px; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border-radius: var(--radius); margin: 10px 12px; padding: 14px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.card-title .more { font-size: 12px; color: var(--text-3); font-weight: 400; }
.section-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 4px; }
.section-bar h3 { font-size: 17px; font-weight: 700; position: relative; padding-left: 10px; }
.section-bar h3::before { content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px; background: linear-gradient(180deg, var(--primary), var(--accent)); }
.section-bar .more { font-size: 12px; color: var(--text-3); }

.btn { display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 22px; padding: 9px 20px; font-size: 14px; cursor: pointer; background: #f0f0f0; color: var(--text); }
.btn-primary { background: linear-gradient(90deg, var(--primary), var(--primary-light)); color: #fff; }
.btn-accent { background: linear-gradient(90deg, var(--accent), #ffb347); color: #fff; }
.btn-outline { background: #fff; border: 1px solid var(--primary); color: var(--primary); }
.btn-block { display: flex; width: calc(100% - 24px); margin: 12px; padding: 12px; font-size: 16px; font-weight: 600; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 15px; }
.btn:disabled { opacity: .5; }

.tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; background: #eaf0ff; color: var(--primary); margin-right: 4px; }
.tag.green { background: #e8f8f0; color: var(--green); }
.tag.blue { background: #eaf2f8; color: var(--blue); }
.tag.gold { background: #fdf6e3; color: var(--gold); }
.tag.red { background: #fdeceb; color: var(--red, #e8442e); }
.tag.gray { background: #f0f0f0; color: var(--text-2); }

.price { color: var(--red); font-weight: 700; }
.price .sym { font-size: 12px; }
.price-old { color: var(--text-3); font-size: 12px; text-decoration: line-through; margin-left: 4px; font-weight: 400; }

.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .ico { font-size: 48px; margin-bottom: 10px; }
.loading { text-align: center; padding: 30px; color: var(--text-3); font-size: 13px; }

/* ---------- 表单 ---------- */
.form-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.form-item label { width: 90px; font-size: 14px; color: var(--text-2); flex-shrink: 0; }
/* 必填项红色星号 */
.form-item label.req::before { content: "*"; color: #e8442e; margin-right: 2px; font-weight: 700; }
.form-item input:not([type=checkbox]):not([type=radio]):not([type=file]), .form-item textarea, .form-item select {
  flex: 1; border: 1px solid #d8dde6; border-radius: 8px; outline: none; font-size: 15px;
  background: #fff; font-family: inherit; padding: 9px 10px; min-width: 0;
}
.form-item input:focus, .form-item textarea:focus, .form-item select:focus { border-color: var(--primary); }
.form-item input:disabled { background: #f5f6f8; color: var(--text-3); }
.form-item textarea { min-height: 80px; resize: vertical; }
.form-item:last-child { border-bottom: none; }

/* ---------- 轮播 ---------- */
.swiper { position: relative; overflow: hidden; border-radius: 0 0 16px 16px; }
.swiper-track { display: flex; transition: transform .4s ease; }
.swiper-track img { width: 100%; flex-shrink: 0; object-fit: cover; }
.swiper-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; }
.swiper-dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.5); transition: all .3s; }
.swiper-dots i.on { width: 16px; background: #fff; }

/* ---------- 金刚区 ---------- */
.kingkong { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px 0; padding: 14px 6px 8px; }
.kingkong a { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); }
.kingkong .kico { width: 44px; height: 44px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: linear-gradient(135deg, #eef3ff, #dce8ff); }

/* ---------- 商品卡片 ---------- */
.goods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px 12px; }
.goods-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.goods-card .gimg { width: 100%; aspect-ratio: 1; object-fit: cover; }
.goods-card .ginfo { padding: 10px; }
.goods-card .gname { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.goods-card .gsub { font-size: 11px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goods-card .gprice { display: flex; align-items: baseline; margin-top: 6px; }
.goods-card .gprice .price { font-size: 18px; }
.goods-card .gsales { font-size: 11px; color: var(--text-3); margin-left: auto; }

/* 横向商品行 */
.goods-row { display: flex; gap: 12px; padding: 12px; background: #fff; border-radius: var(--radius); margin: 10px 12px; box-shadow: var(--shadow); }
.goods-row img { width: 100px; height: 100px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.goods-row .gr-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.goods-row .gname { font-size: 15px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.goods-row .gsub { font-size: 12px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goods-row .gbottom { margin-top: auto; display: flex; align-items: baseline; }

/* ---------- 秒杀条 ---------- */
.seckill-bar { display: flex; align-items: center; background: linear-gradient(90deg, #d42b1e, #ff6a3d); border-radius: var(--radius); margin: 10px 12px; padding: 10px 14px; color: #fff; }
.seckill-bar .sk-title { font-size: 17px; font-weight: 800; font-style: italic; }
.countdown { display: flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 11px; }
.countdown b { background: #333; border-radius: 4px; padding: 2px 5px; font-size: 12px; font-family: monospace; }
.seckill-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 4px 12px 12px; scrollbar-width: none; }
.seckill-scroll::-webkit-scrollbar { display: none; }
.sk-item { flex-shrink: 0; width: 118px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); }
.sk-item img { width: 118px; height: 100px; object-fit: cover; }
.sk-item .sk-info { padding: 6px 8px 8px; }
.sk-item .sk-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sk-item .sk-price { color: var(--red); font-weight: 700; font-size: 15px; }
.sk-item .sk-orig { font-size: 10px; color: var(--text-3); text-decoration: line-through; }
.sk-progress { height: 5px; border-radius: 3px; background: #ffe0d8; margin-top: 4px; overflow: hidden; }
.sk-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--accent)); }
.sk-sold { font-size: 10px; color: var(--red); }

/* ---------- 列表行 ---------- */
.list-row { display: flex; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-title { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .lr-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.list-row .lr-right { margin-left: 10px; text-align: right; flex-shrink: 0; }

/* ---------- 弹窗/Toast ---------- */
.toast { position: fixed; top: 45%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,.75); color: #fff; padding: 12px 22px; border-radius: 10px; font-size: 14px; z-index: 999; max-width: 80%; text-align: center; }
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 900; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 750px; border-radius: 16px 16px 0 0; padding: 20px 16px calc(20px + var(--safe-bottom)); max-height: 80vh; overflow-y: auto; }
.modal h3 { font-size: 17px; margin-bottom: 12px; text-align: center; }
.modal .close { position: absolute; right: 16px; top: 16px; font-size: 20px; color: var(--text-3); cursor: pointer; }

/* ---------- 图片上传控件(前后台通用) ---------- */
.img-upload { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.img-upload img { width: 110px; height: 74px; object-fit: cover; border-radius: 8px; border: 1px solid #eee; background: #f5f6f8; }
.img-upload .iu-empty { width: 110px; height: 74px; border-radius: 8px; border: 1px dashed #ccc; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-3); background: #fafbfc; }

/* ---------- 图标角标(我的消息等) ---------- */
.s-ico { position: relative; }
.s-ico .badge { position: absolute; top: -6px; right: -8px; background: var(--red); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 15px; min-width: 16px; text-align: center; }

/* ---------- VR 全景查看器 ---------- */
.pano-wrap { position: relative; overflow: hidden; border-radius: var(--radius); margin: 10px 12px; height: 220px; background: #000; touch-action: pan-y; user-select: none; }
.pano-wrap .pano-img { position: absolute; top: 0; left: 0; height: 100%; max-width: none; will-change: transform; pointer-events: none; }
.pano-wrap .pano-hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: rgba(0,0,0,.45); color: #fff; font-size: 11px; border-radius: 12px; padding: 3px 12px; pointer-events: none; }
.pano-wrap .pano-title { position: absolute; left: 12px; top: 10px; background: rgba(0,0,0,.45); color: #fff; font-size: 12px; border-radius: 10px; padding: 3px 10px; pointer-events: none; }

/* ---------- 状态徽章 ---------- */
.status { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.status.orange { background: #fff3e8; color: #e67e22; }
.status.green { background: #e8f8f0; color: var(--green); }
.status.red { background: #fff0ec; color: var(--red); }
.status.gray { background: #f0f0f0; color: var(--text-2); }
.status.blue { background: #eaf2f8; color: var(--blue); }

/* ---------- 商家卡片 ---------- */
.shop-card { display: flex; gap: 12px; background: #fff; border-radius: var(--radius); margin: 10px 12px; padding: 12px; box-shadow: var(--shadow); }
.shop-card .slogo { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.shop-card .s-info { flex: 1; min-width: 0; }
.shop-card .s-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.shop-card .s-cat { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.shop-card .s-intro { font-size: 12px; color: var(--text-2); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-card .s-score { text-align: right; flex-shrink: 0; }
.credit-badge { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--gold); font-weight: 700; }

/* 步骤条(订单状态) */
.steps { display: flex; padding: 14px 0 6px; }
.step { flex: 1; text-align: center; font-size: 11px; color: var(--text-3); position: relative; }
.step .dot { width: 20px; height: 20px; margin: 0 auto 4px; border-radius: 50%; background: #e0e0e0; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.step.done { color: var(--primary); }
.step.done .dot { background: var(--primary); }

/* 桌面适配 */
@media (min-width: 760px) {
  body { background: #e8eaed; }
  .page { box-shadow: 0 0 30px rgba(0,0,0,.08); }
}

/* ---------- 富文本编辑器（商品详情，wangEditor 封装） ---------- */
.rich-wrap { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.rich-wrap .we-toolbar { border-bottom: 1px solid var(--line); background: #fafafa; }
.rich-wrap .we-textarea { overflow-y: hidden; background: #fff; }

/* wangEditor 内部：去掉它自带的 height:100% 与滚动，让容器高度生效 */
.rich-wrap .we-textarea { overflow-y: hidden; background: #fff; }
.rich-wrap .we-textarea .w-e-text-container { height: 100% !important; }
.rich-wrap .we-textarea .w-e-text-placeholder { color: var(--text-3); }
/* 编辑区内的图片/表格/视频一律自适应容器宽度，避免大图撑出编辑框产生横向滚动 */
.rich-wrap .we-textarea img,
.rich-wrap .we-textarea video,
.rich-wrap .we-textarea table,
.rich-wrap .we-textarea iframe { max-width: 100% !important; height: auto; }
.rich-wrap .we-textarea table { border-collapse: collapse; width: 100%; }
.rich-wrap .we-textarea td, .rich-wrap .we-textarea th { border: 1px solid var(--line); padding: 5px 8px; }
/* 图片宽度快捷调节条（选中图片后出现在编辑区底部） */
.rich-wrap .img-resize-bar { display: flex; gap: 6px; padding: 8px 12px; background: #f7f9ff;
  border-top: 1px solid var(--line); font-size: 12px; align-items: center; }
.rich-wrap .img-resize-bar button { padding: 4px 12px; border: 1px solid #c8d4f5; background: #fff;
  border-radius: 5px; cursor: pointer; color: var(--text-2); }
.rich-wrap .img-resize-bar button:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.rich-wrap .img-resize-bar::before { content: "图片宽度"; color: var(--text-3); margin-right: 2px; }

/* 降级编辑器（wangEditor 未加载时的简易版） */
.rich-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #fafafa; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rich-bar button { min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--line); background: #fff;
  border-radius: 5px; font-size: 13px; color: var(--text-2); cursor: pointer; line-height: 1; }
.rich-bar button:hover { background: #f0f4ff; border-color: #c8d4f5; color: var(--brand, #2b6cff); }
.rich-bar button:active { transform: translateY(1px); }
.rich-editor { padding: 10px 12px; font-size: 14px; line-height: 1.8; color: var(--text-1); outline: none;
  overflow-y: auto; word-break: break-word; }
.rich-editor img { max-width: 100%; height: auto; border-radius: 6px; margin: 6px 0; display: block; }
.rich-editor h3 { font-size: 15px; margin: 10px 0 6px; }
.rich-editor blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--line); color: var(--text-2); background: #fafafa; }
.rich-editor ul, .rich-editor ol { padding-left: 22px; margin: 6px 0; }
.rich-uploading { color: var(--text-3); font-size: 13px; padding: 6px 0; }

/* 商品详情：整块「详情」改为上下布局。
   必须用 .form-item.rich-item 选择器提高特异性 —— 单写 .rich-item > label
   会被前面的 `.form-item label { width:90px; flex-shrink:0 }` 压过，
   结果 label 仍被压成 90px 竖排窄条。 */
.form-item.rich-item { display: block; padding: 14px 0; }
.form-item.rich-item > label { display: block; width: auto; font-size: 13px; font-weight: 700;
  color: var(--text-2); margin-bottom: 8px; }

/* 富文本渲染区（移动端商品详情等；内容已由服务端白名单净化） */
.rich-view { font-size: 14px; line-height: 1.85; color: var(--text-2); word-break: break-word; }
.rich-view img { max-width: 100%; height: auto; border-radius: 8px; margin: 10px 0; display: block; }
.rich-view h1, .rich-view h2, .rich-view h3 { color: var(--text-1); margin: 14px 0 8px; }
.rich-view h1 { font-size: 18px; } .rich-view h2 { font-size: 16px; } .rich-view h3 { font-size: 15px; }
.rich-view p { margin: 8px 0; }
.rich-view ul, .rich-view ol { padding-left: 22px; margin: 8px 0; }
.rich-view blockquote { margin: 10px 0; padding: 8px 14px; border-left: 3px solid var(--brand, #2b6cff);
  background: #f7f9ff; color: var(--text-2); border-radius: 0 6px 6px 0; }
.rich-view a { color: var(--brand, #2b6cff); }
.rich-view table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.rich-view td, .rich-view th { border: 1px solid var(--line); padding: 6px 8px; font-size: 13px; }
.rich-view hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }

/* 从「我的消息」跳到列表页时的高亮定位（AJL.focusTarget 添加，4 秒后自动褪色） */
.msg-focus-hl {
  animation: msgFocusIn 1.6s ease-out;
  box-shadow: 0 0 0 2px var(--primary, #1f5eff), var(--shadow);
  border-radius: var(--radius);
}
@keyframes msgFocusIn {
  0%, 100% { background: transparent; }
  30%      { background: #eaf1ff; }
}
