/* ============================================
   十香厨自助烤肉订货平台 - 分店移动端
   © 立鹏科技 (LiPeng Technology)
   ============================================ */

body {
  background: var(--bg);
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ---------- 顶栏 ---------- */
.m-head {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 15px 10px;
}
.m-head .brand-row { display: flex; align-items: center; gap: 9px; }
.m-head .logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(46, 124, 230, .18);
}
.m-head .logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-head h1 { font-size: 16px; letter-spacing: .5px; }
.m-head .branch { font-size: 11.5px; color: var(--text-sub); margin-top: 2px; }
.m-head .logout { margin-left: auto; }

/* ---------- 底部 TabBar（毛玻璃） ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; z-index: 20;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px; font-size: 10.5px; color: var(--text-faint);
  cursor: pointer; user-select: none; position: relative;
}
.tab.active { color: var(--primary); font-weight: 600; }
.tab .dot {
  position: absolute; top: 5px; right: calc(50% - 16px);
  background: var(--danger); color: #fff; font-size: 9.5px; min-width: 15px; height: 15px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

.m-view { display: none; padding: 12px 12px calc(175px + env(safe-area-inset-bottom)); }
.m-view.active { display: block; animation: viewIn .18s ease; }

/* ---------- 分类 chips ---------- */
.m-chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 2px;
  scrollbar-width: none;
}
.m-chips::-webkit-scrollbar { display: none; }
.m-chips .chip { flex: none; }

/* ---------- 商品卡片 ---------- */
.p-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.p-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  min-width: 0;
}
.p-card .p-spec { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.p-card .p-stock { font-size: 11px; margin-top: 6px; color: var(--text-sub); }
.p-card .p-stock b { font-weight: 600; }
.p-card .p-stock.low b { color: var(--danger); }
.p-card .p-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; flex-wrap: wrap; gap: 6px; }
.p-card .p-price { font-size: 15px; font-weight: 700; color: #d0560a; }
.p-card .p-price small { font-size: 10.5px; font-weight: 400; color: var(--text-faint); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.stepper button {
  width: 28px; height: 30px; border: none; background: #f6f9fd; cursor: pointer;
  color: var(--primary); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:disabled { color: #c3cedb; }
.stepper .val { min-width: 34px; text-align: center; font-size: 13px; font-weight: 700; }

/* ---------- 购物车栏 ---------- */
.cart-bar {
  position: fixed; bottom: calc(62px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px); max-width: 536px; z-index: 19;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 6px 24px rgba(23, 43, 77, .14);
  display: none; align-items: center; gap: 10px; padding: 10px 13px;
}
.cart-bar.show { display: flex; animation: upIn .2s ease; }
@keyframes upIn { from { opacity: 0; transform: translate(-50%, 10px); } }
.cart-bar .c-ic {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--primary-weak); color: var(--primary);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.cart-bar .c-ic .n {
  position: absolute; top: -5px; right: -6px; background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; font-weight: 600;
}
.cart-bar .c-info { flex: 1; line-height: 1.3; }
.cart-bar .c-info .t { font-size: 11px; color: var(--text-sub); }
.cart-bar .c-info .m { font-size: 16px; font-weight: 700; color: #d0560a; }
.cart-bar .btn-go {
  padding: 9px 18px; border-radius: 10px; border: none;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}
.cart-bar .btn-go:disabled { background: #b8cfe8; }

/* ---------- 订单卡片 ---------- */
.o-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 13px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.o-card .o-top { display: flex; align-items: center; gap: 8px; }
.o-card .o-no { font-size: 13px; font-weight: 600; font-family: Consolas, monospace; }
.o-card .o-time { font-size: 11px; color: var(--text-faint); margin-left: auto; }
.o-card .o-mid { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.o-card .o-amount { font-size: 16px; font-weight: 700; color: #d0560a; }
.o-card .o-cnt { font-size: 11.5px; color: var(--text-sub); }
.o-card .o-acts { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }
.o-card .o-note { font-size: 11.5px; color: var(--text-sub); margin-top: 7px; background: #f7fafe; border-radius: 7px; padding: 6px 9px; }

/* ---------- 库存列表 ---------- */
.s-list { margin-top: 10px; }
.s-item {
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 13px; margin-bottom: 9px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 10px;
}
.s-item .s-info { flex: 1; min-width: 0; }
.s-item .s-name { font-size: 14px; font-weight: 600; }
.s-item .s-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.s-item .s-qty { text-align: right; }
.s-item .s-qty b { font-size: 16px; font-weight: 700; }
.s-item .s-qty span { font-size: 11px; color: var(--text-sub); display: block; }

/* ---------- 库存统计卡 + 出库按钮 ---------- */
.st-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.st-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 8px; box-shadow: var(--shadow); text-align: center;
}
.st-card .st-k { font-size: 11px; color: var(--text-sub); }
.st-card .st-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 3px 0 1px; color: var(--primary); }
.st-card .st-s { font-size: 10.5px; color: var(--text-faint); }
.s-item .s-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.s-item .s-right .s-qty { text-align: right; }

/* ---------- 出入库记录 ---------- */
.lg-item {
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  padding: 10px 12px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.lg-item .lg-top { display: flex; align-items: center; gap: 8px; }
.lg-item .lg-name { font-size: 13.5px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-item .lg-mid { display: flex; align-items: baseline; justify-content: space-between; margin-top: 5px; }
.lg-item .lg-time { font-size: 11px; color: var(--text-faint); }
.lg-item .lg-sub { font-size: 11px; color: var(--text-sub); margin-top: 4px; line-height: 1.5; }

/* ---------- 出入库记录筛选 ---------- */
.lg-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.lg-filters .input { flex: 1 1 120px; width: auto; }
.lg-filters .select { flex: 1 1 110px; width: auto; }
.lg-filters .btn { flex: none; }

/* ============================================
   电脑宽屏适配（分店端在电脑浏览器打开时）
   手机（≤768px）保持窄界面不变
   ============================================ */
@media (min-width: 769px) {
  body { max-width: 1080px; }
  .m-head { padding: 14px 24px 12px; }
  .m-head .logo { width: 42px; height: 42px; }
  .m-head h1 { font-size: 18px; }
  .m-view { padding: 18px 24px calc(120px + env(safe-area-inset-bottom)); }
  .tabbar { max-width: 1080px; }
  .cart-bar { max-width: 1032px; bottom: calc(66px + env(safe-area-inset-bottom)); }

  .m-search .input { max-width: 420px; }
  .p-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .st-cards { gap: 12px; }
  .st-card .st-v { font-size: 20px; }

  /* 订单卡片双列 */
  #oList { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  #oList .o-card { margin-bottom: 0; }

  /* 库存与出入库记录双列 */
  .s-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .s-list .s-item { margin-bottom: 0; }
  #mLogs .lg-item { margin-bottom: 10px; }

  /* 弹窗放宽 */
  .modal { width: 560px; }
  .modal-lg { width: 780px; }
  .pd-qty-bar { max-width: 420px; }
}

/* ---------- 我的 ---------- */
.me-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 13px;
}
.me-card .avatar {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  background: linear-gradient(135deg, #3b8af0, #2e6fd0);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.me-card .nm { font-size: 16px; font-weight: 700; }
.me-card .bd { font-size: 12px; color: var(--text-sub); margin-top: 3px; }

.me-row {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 12px;
}
.me-row .cell {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  font-size: 13.5px; border-bottom: 1px solid #eef3f8; cursor: pointer;
}
.me-row .cell:last-child { border-bottom: none; }
.me-row .cell .ic { color: var(--primary); }
.me-row .cell .val { margin-left: auto; color: var(--text-faint); font-size: 12.5px; display: flex; align-items: center; gap: 4px; }
.me-foot { text-align: center; font-size: 11px; color: var(--text-faint); line-height: 1.8; padding: 8px 0 14px; }

.empty { text-align: center; padding: 44px 0; color: var(--text-faint); font-size: 12.5px; }
.empty .ic { opacity: .35; display: block; margin: 0 auto 8px; }

/* 搜索栏 */
.m-search { display: flex; gap: 8px; margin-top: 10px; }
.m-search .input { flex: 1; }

/* ---------- 商品卡片：供货商 + 资质入口 ---------- */
.p-card .p-name {
  font-size: 14px; font-weight: 600; line-height: 1.35; cursor: pointer;
}
.p-card .p-name:active { opacity: .6; }
.p-card .p-name .arr { color: var(--text-faint); font-weight: 400; font-size: 11px; margin-left: 3px; }
.p-card .p-sup {
  font-size: 10.5px; color: var(--text-sub); margin-top: 3px;
  display: flex; align-items: center; gap: 3px;
  white-space: nowrap; overflow: hidden;
}
.p-card .p-sup .sup-txt { overflow: hidden; text-overflow: ellipsis; }

/* ---------- 商品详情弹窗 ---------- */
.pd-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 2px; border-bottom: 1px dashed #e8eff7; font-size: 13px;
}
.pd-row:last-of-type { border-bottom: none; }
.pd-row .k { color: var(--text-sub); flex: none; margin-right: 12px; }
.pd-row .v { text-align: right; word-break: break-all; }
.pd-qty-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #f7fafe; border: 1px solid #d4e5fb; border-radius: 10px;
  padding: 10px 12px; margin-top: 12px;
}

/* ---------- 检验资质查询视图 ---------- */
.q-head { display: flex; gap: 8px; margin-bottom: 10px; }
.q-head .input { flex: 1; }
.q-item { cursor: pointer; }
.q-item:active { background: #f7fafe; }

.p-files {
  margin-top: 7px; width: 100%;
  border: 1px dashed #c6dcf7; background: #f3f8ff; color: var(--primary);
  border-radius: 8px; padding: 5px 8px; font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-family: inherit;
}
.p-files:active { background: #e4effc; }

/* ============================================
   确认订货单（美化版）
   ============================================ */
.ck-branch {
  display: flex; gap: 10px; align-items: center;
  background: linear-gradient(135deg, #e8f1fd, #f4f9ff);
  border: 1px solid #d4e5fb; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px;
}
.ck-branch .b-logo {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, #3b8af0, #2e6fd0);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.ck-branch .b-name { font-size: 14.5px; font-weight: 700; }
.ck-branch .b-tip { font-size: 11px; color: var(--text-sub); margin-top: 2px; line-height: 1.4; }

.ck-title {
  font-size: 12.5px; color: var(--text-sub); font-weight: 600;
  margin: 2px 0 8px; display: flex; align-items: center; gap: 6px;
}
.ck-item {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px; margin-bottom: 9px;
  display: flex; gap: 10px; align-items: center;
}
.ck-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
}
.ck-item .i-info { flex: 1; min-width: 0; }
.ck-item .i-name { font-size: 13.5px; font-weight: 600; }
.ck-item .i-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.ck-item .i-sup {
  font-size: 10.5px; color: var(--primary); margin-top: 3px;
  display: flex; align-items: center; gap: 3px;
  white-space: nowrap; overflow: hidden;
}
.ck-item .i-sup .sup-txt { overflow: hidden; text-overflow: ellipsis; }
.ck-item .i-right { text-align: right; flex: none; }
.ck-item .i-amount { font-size: 14px; font-weight: 700; color: #d0560a; margin-top: 5px; font-variant-numeric: tabular-nums; }

.ck-summary {
  background: linear-gradient(135deg, #2e7ce6, #1f6ad4);
  border-radius: 12px; padding: 13px 15px; color: #fff; margin-top: 4px;
}
.ck-summary .s-row { display: flex; justify-content: space-between; align-items: baseline; }
.ck-summary .s-total { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.ck-summary .s-sub { font-size: 11px; opacity: .85; margin-top: 4px; }

/* ---------- 资质文件列表（与商品资质弹窗共用） ---------- */
.pf-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid #eef3f8; }
.pf-row:last-child { border-bottom: none; }
.pf-thumb {
  width: 46px; height: 46px; border-radius: 8px; border: 1px solid var(--border);
  object-fit: cover; background: #f7fafe; flex: none;
}
.pf-thumb.pf-pdf { display: flex; align-items: center; justify-content: center; color: var(--danger); }
.pf-info { flex: 1; min-width: 0; }
.pf-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
