/* 号速交易 zh.hszjy.org */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: #f4f6fb; color: #1f2b45; -webkit-font-smoothing: antialiased;
}
a { color: #0866ff; text-decoration: none; }
a:hover { opacity: .85; }

/* 顶部导航 */
.nav {
  background: linear-gradient(90deg, #12214e, #0866ff);
  padding: 0 20px; height: 60px; display: flex; align-items: center;
  justify-content: space-between; color: #fff; position: sticky; top: 0; z-index: 40;
  box-shadow: 0 2px 12px rgba(18, 33, 78, .18);
}
.nav .brand { color: #fff; font-weight: 800; font-size: 18px; letter-spacing: .5px; }
.nav-links { display: flex; gap: 18px; }
.nav-links a { color: #dfe8ff; font-size: 14px; font-weight: 600; }
.nav-links a:hover { color: #fff; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; }

/* 双栏：左分类 + 右商品 */
.shop { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 18px; align-items: start; }
.side {
  background: #fff; border-radius: 14px; padding: 14px 12px;
  box-shadow: 0 4px 16px rgba(35, 57, 86, .06);
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto;
  overflow-x: hidden; min-width: 0;
}
.side-title { margin: 0 0 10px; font-size: 14px; color: #7a869c; font-weight: 700; }
.cats { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cat {
  display: flex; justify-content: space-between; align-items: center; gap: 7px;
  padding: 7px 9px; border-radius: 9px; color: #33415c; font-size: 13.5px; line-height: 1.3;
  min-width: 0; overflow: hidden;
}
.cat:hover { background: #f1f5fd; }
.cat.active { background: #0866ff; color: #fff; font-weight: 700; }
.cat-icon { width: 17px; height: 17px; flex: 0 0 17px; display: block; border-radius: 4px; object-fit: contain; background: #f2f5fb; }
.cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat .cnt { font-size: 11px; color: #93a0b8; flex: none; }
.cat.active .cnt { color: #d5e3ff; }

/* 商品列表 */
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.sortbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sortbar-label { font-size: 12.5px; color: #7a869c; font-weight: 700; }
.sort-btn {
  border: 1px solid #dbe3ef; background: #fff; color: #33415c; cursor: pointer;
  padding: 5px 12px; border-radius: 20px; font-size: 12.5px; font-family: inherit; font-weight: 600;
}
.sort-btn:hover { border-color: #0866ff; color: #0866ff; }
.sort-btn.active { background: #0866ff; border-color: #0866ff; color: #fff; }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.item {
  background: #fff; border-radius: 14px; padding: 14px; display: flex; gap: 13px;
  box-shadow: 0 4px 16px rgba(35, 57, 86, .06); transition: .18s;
}
.item:hover { box-shadow: 0 8px 24px rgba(35, 57, 86, .12); transform: translateY(-1px); }
.thumb {
  width: 52px; height: 52px; flex: 0 0 52px; object-fit: contain;
  border-radius: 11px; background: #f2f5fb; padding: 4px;
}
.thumb-empty { display: block; }
.info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.name { margin: 0 0 6px; font-size: 15px; line-height: 1.4; font-weight: 700; color: #1b2740; }
.desc {
  margin: 0 0 10px; font-size: 12.5px; line-height: 1.55; color: #6b7891;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price-box { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.stock { font-size: 12px; color: #7a869c; white-space: nowrap; }
.stock-low { color: #e6812b; font-weight: 600; }
.price { color: #e63946; font-weight: 800; font-size: 16px; }

.buy {
  border: 0; cursor: pointer; padding: 7px 18px; border-radius: 9px;
  background: #0866ff; color: #fff; font-weight: 700; font-size: 13.5px;
}
.buy:hover { background: #0757d8; }
.buy.disabled { background: #d6dced; color: #8f9ab2; cursor: not-allowed; }

.empty { color: #7a869c; text-align: center; padding: 40px; grid-column: 1/-1; }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; background: rgba(12, 22, 45, .55); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  backdrop-filter: blur(2px);
}
.mask[hidden] { display: none; }
.modal {
  background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 50px rgba(10, 20, 40, .3); animation: pop .16s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-title { margin: 0 0 6px; font-size: 17px; }
.modal-product { margin: 0 0 16px; font-size: 13.5px; color: #51607a; line-height: 1.5; }
.field { margin-bottom: 14px; }
.label { display: block; font-size: 12.5px; color: #7a869c; font-weight: 700; margin-bottom: 6px; }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid #dbe3ef; border-radius: 10px;
  font-size: 14px; outline: none; font-family: inherit;
}
.input:focus { border-color: #0866ff; box-shadow: 0 0 0 3px rgba(8, 102, 255, .12); }
.hint { font-size: 12px; color: #8a6d3b; background: #fff8e6; border-radius: 8px; padding: 8px 10px; margin: 8px 0 0; line-height: 1.5; }
.pays { display: flex; gap: 10px; }
.pay {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  border: 1.5px solid #dbe3ef; border-radius: 10px; padding: 10px; cursor: pointer; font-size: 13.5px; font-weight: 600;
}
.pay:has(input:checked) { border-color: #0866ff; background: #f2f7ff; color: #0866ff; }
.modal-msg { margin: 0 0 10px; font-size: 13px; color: #e63946; min-height: 18px; }
.modal-actions { display: flex; gap: 10px; }
.btn {
  border: 0; cursor: pointer; padding: 11px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 700; font-family: inherit; display: inline-block; text-align: center;
}
.btn.primary { background: #0866ff; color: #fff; flex: 1; }
.btn.primary:hover { background: #0757d8; }
.btn.ghost { background: #eef2f9; color: #33415c; }
.btn.ghost:hover { background: #e2e9f4; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* 订单 / 查询页 */
.panel { background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 4px 16px rgba(35, 57, 86, .06); max-width: 900px; }
.panel-title { margin: 0 0 14px; font-size: 18px; }
.sub-title { font-size: 15px; margin: 20px 0 8px; }
table { width: 100%; border-collapse: collapse; }
.kv th {
  text-align: left; width: 110px; color: #7a869c; font-weight: 600; font-size: 13px;
  padding: 9px 10px; border-bottom: 1px solid #eef2f8; vertical-align: top;
}
.kv td { padding: 9px 10px; border-bottom: 1px solid #eef2f8; font-size: 14px; }
.list-table th { color: #7a869c; font-size: 12.5px; }
.list-table { margin-top: 18px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: #eef2f9; color: #51607a; font-weight: 600; }
.tag.ok { background: #e6f7ee; color: #12805c; }
.tag.warn { background: #fff6e5; color: #a76900; }
.tag.bad { background: #fdeaea; color: #c02626; }
.accounts {
  background: #0f1a2e; color: #d7e3f5; padding: 14px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-all;
  max-height: 420px; overflow: auto;
}
.query-form { max-width: 420px; margin: 14px 0 6px; }

.foot { text-align: center; color: #93a0b8; font-size: 12.5px; padding: 22px; }

/* ===== 移动端适配（2026-09-23 重做）===== */
@media (max-width: 860px) {
  .wrap { padding: 14px 12px 32px; }

  /* 顶部导航：自适应高度 + 允许换行 + 缩小留白字号，任何屏宽都不再顶宽页面 */
  .nav { height: auto; min-height: 56px; padding: 8px 12px; flex-wrap: wrap; align-items: center; }
  .nav .brand { font-size: 16.5px; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 13.5px; }

  /* 裸 1fr 的 grid 最小尺寸是 auto，会被内容顶宽 → 必须用 minmax(0, 1fr) */
  .shop { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .side { position: static; max-height: none; top: auto; }

  /* 分类栏：单行横滑并贴到容器两侧（抵消父级内边距），右侧不再留一截空白 */
  .cats {
    flex-direction: row; flex-wrap: nowrap;
    overflow-x: auto; overflow-y: hidden;
    gap: 8px; margin: 0 -12px; padding: 0 12px 6px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .cats::-webkit-scrollbar { display: none; }
  .cat { white-space: nowrap; background: #f5f8fd; flex: 0 0 auto; max-width: 62vw; }

  /* 排序栏：同样单行横滑贴边，避免换行后右侧留白 */
  .sortbar {
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    margin: 0 -12px; padding: 0 12px 4px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .sortbar::-webkit-scrollbar { display: none; }
  .sortbar-label, .sort-btn { flex: 0 0 auto; }

  /* 商品卡单列铺满；卡片自身裁掉溢出内容，绝不撑宽页面 */
  .list { grid-template-columns: minmax(0, 1fr); }
  .item { overflow: hidden; }
  .info { overflow: hidden; }
  .name, .desc { overflow-wrap: anywhere; word-break: break-word; }
  /* 「采购式发货 · 预计 5～20 分钟」这类 nowrap 长标签是窄屏溢出的元凶 */
  .item .ship { white-space: normal; max-width: 100%; }
}

@media (max-width: 480px) {
  .nav .brand { font-size: 16px; }
  .nav-links { gap: 12px; }
  .list { gap: 12px; }
  .item { padding: 12px; gap: 11px; }
  .thumb { width: 46px; height: 46px; flex: 0 0 46px; }
  /* 购买按钮独占一行铺满，彻底杜绝「要被挤出屏幕」 */
  .bottom { flex-wrap: wrap; }
  .price-box { width: 100%; }
  .buy { flex: 1 0 100%; padding: 10px 18px; font-size: 14px; }
  /* 排序按钮收紧，5 个标签在 360~430px 屏一屏放得下，基本无需横滑 */
  .sortbar { gap: 6px; }
  .sortbar-label { font-size: 12px; }
  .sort-btn { padding: 5px 10px; font-size: 12px; }
}

/* ===== 购买数量控件 ===== */
.qty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qty-btn {
  width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid #dfe5ef; background: #fff;
  border-radius: 10px; font-size: 18px; line-height: 1; color: #33415c; cursor: pointer;
}
.qty-btn:hover:not([disabled]) { border-color: #0866ff; color: #0866ff; background: #f2f7ff; }
.qty-btn[disabled] { opacity: .45; cursor: not-allowed; }
.qty-input { width: 84px; flex: 0 0 84px; text-align: center; padding: 8px 6px; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input { -moz-appearance: textfield; appearance: textfield; }
.qty-hint { font-size: 12px; color: #7a869c; }
.qty-quick { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.qty-quick button {
  padding: 4px 13px; font-size: 12.5px; border: 1px solid #dfe5ef; background: #f7f9fc;
  color: #33415c; border-radius: 999px; cursor: pointer;
}
.qty-quick button:hover { border-color: #0866ff; color: #0866ff; background: #f2f7ff; }
.qty-total { margin: 8px 0 0; font-size: 13px; color: #51607a; }
.qty-sum { color: #e63946; font-size: 16px; }
.qty-note { margin-left: 6px; font-size: 12px; color: #8a6d3b; }

/* ===== 订单页提示 ===== */
.ok-hint { background: #eaf7ee; color: #1a7f37; }
.sub-title { margin: 18px 0 8px; font-size: 15px; }
.accounts {
  background: #f6f8fc; border: 1px solid #e3e9f2; border-radius: 10px; padding: 12px;
  font-size: 13px; white-space: pre-wrap; word-break: break-all; max-height: 320px; overflow: auto;
}

/* 交付方式标签（上游 fulfillment：local 现货 / connected 采购式） */
.ship{display:inline-block;margin:2px 0 4px;padding:1px 7px;border-radius:10px;font-size:11.5px;line-height:1.6;white-space:nowrap}
.ship-fast{background:#e8f5e9;color:#2e7d32;border:1px solid #a5d6a7}
.ship-slow{background:#fff8e1;color:#8a5a00;border:1px solid #ffe082}
.modal-deliver{margin:6px 0 2px;padding:7px 10px;border-radius:8px;font-size:12.5px;line-height:1.5}
.modal-deliver.fast{background:#e8f5e9;color:#2e7d32;border:1px solid #a5d6a7}
.modal-deliver.slow{background:#fff8e1;color:#8a5a00;border:1px solid #ffe082}

/* ===== 分类导航两级：一级分组 / 二级分类（2026-09-23 用户要求排序：FB → TK → 飞机号 → 其他软件） ===== */
.cat-group {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 12px 0 3px; padding: 5px 9px; border-radius: 8px;
  background: #eef4ff; color: #0b63e5; font-size: 12px; font-weight: 800;
  letter-spacing: .4px; white-space: nowrap;
}
.cat-group:hover { background: #e2ecff; }
.cat-group.active { background: #0866ff; color: #fff; }
.cat-group .cnt { font-size: 11px; font-weight: 600; color: #7f95b8; }
.cat-group.active .cnt { color: #d5e3ff; }
.cats .cat { padding-left: 14px; }          /* 二级分类缩进，视觉上从属于一级 */

@media (max-width: 860px) {
  /* 横滑条里一级分组作为分隔标签内联展示，二级不缩进 */
  .cats .cat { padding-left: 9px; }
  .cat-group { flex: 0 0 auto; margin: 0 0 0 6px; padding: 5px 10px; }
  .cat-group:first-of-type { margin-left: 0; }
}

/* ===== 手机端分类栏折叠（2026-09-23 用户选定：默认只显示一级，点一级原地展开二级） ===== */
.g-right { display: flex; align-items: center; gap: 6px; flex: none; }
.cat-group .arrow { display: none; font-size: 11px; line-height: 1; transition: transform .16s ease; }
.cat-group.open .arrow { transform: rotate(180deg); }

@media (max-width: 860px) {
  /* 竖排目录（覆盖上面的横滑方案）：默认只留「全部商品」+ 4 个一级分组 */
  .cats {
    flex-direction: column; flex-wrap: nowrap;
    overflow: visible; margin: 0; padding: 0; gap: 2px;
  }
  .cats .cat { display: none; padding-left: 26px; max-width: none; width: 100%; }
  .cats .cat-all,
  .cats .cat.open { display: flex; }
  .cat-group {
    flex: none; width: 100%; margin: 0; padding: 8px 10px; border-radius: 9px;
    font-size: 13px; letter-spacing: .3px; cursor: pointer;
  }
  .cat-group .arrow { display: inline-block; }
  .cat-group.open { background: #0866ff; color: #fff; }
  .cat-group.open .cnt { color: #d5e3ff; }
  .cats .cat.open { background: #f5f8fd; }
  .cats .cat.open.active { background: #0866ff; }
}
