/* ============================================================
   宠物烘焙 ERP —— 移动优先样式
   手机 (<=640px) 是主要使用场景（录单、查物流），桌面 (>900px) 放宽密度。
   ============================================================ */

:root {
  --bg: #faf7f2;
  --card: #ffffff;
  --ink: #2c2622;
  --muted: #8a7d72;
  --line: #ece4da;
  --accent: #d97a4a;
  --accent-soft: #fdf1e8;
  --good: #3f8f6b;
  --bad: #c2543f;
  --warn: #c99a2e;
  --info: #4a7fb5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(44, 38, 34, .06), 0 4px 16px rgba(44, 38, 34, .04);
  --tabbar-h: 58px;
  /* 苹果/安卓安全区，刘海屏底部不会挡住导航 */
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* 手机上避免双击缩放带来的 300ms 延迟 */
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 顶栏：手机上只留品牌名 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 16px; height: 52px;
  background: rgba(250, 247, 242, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.logo { font-size: 18px; }
.nav { display: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--muted); font-size: 10px;
}
.tabbar .ti { font-size: 18px; line-height: 1; filter: grayscale(1) opacity(.6); }
.tabbar a.active { color: var(--accent); }
.tabbar a.active .ti { filter: none; }

/* ---------- 客户选择器（订单页） ---------- */
.customer-picker {
  background: #fdfbf9; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; margin-bottom: 14px;
}
.cp-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; font-size: 14px;
}
.cp-search { display: flex; flex-direction: column; gap: 8px; }
.cp-search select { max-width: 100%; }
.cp-search select option { padding: 6px 8px; }

.cp-status {
  margin-top: 10px; padding: 9px 11px; border-radius: 8px;
  font-size: 13px; line-height: 1.55;
}
.cp-status.ok { background: #e6f4ee; color: var(--good); border: 1px solid #cfe8dd; }
.cp-status.existing { background: #e8f0f8; color: #2f5f8a; border: 1px solid #d3e2f0; }
.cp-status.new { background: #fbf3df; color: #8a6a1f; border: 1px solid #f0e2c0; }
.cp-status .btn { margin-top: 6px; }

/* 勾选框行：手机上好点 */
.checkline {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13.5px; color: var(--ink); margin-bottom: 0; cursor: pointer;
}
.checkline input[type="checkbox"] {
  width: 18px; height: 18px; flex: 0 0 auto; margin-top: 1px;
  accent-color: var(--accent);
}

/* ---------- 布局 ---------- */
.wrap {
  max-width: 1180px; margin: 0 auto;
  padding: 16px 14px calc(var(--tabbar-h) + var(--safe-b) + 28px);
}
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
h1 { font-size: 19px; margin: 0 0 3px; font-weight: 600; }
.sub { color: var(--muted); font-size: 12.5px; margin: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 12px;
}
.card h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
.card h2 .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }

.grid { display: grid; gap: 10px; }
.grid.k4 { grid-template-columns: repeat(2, 1fr); }
.grid.k3 { grid-template-columns: 1fr; }
.grid.k2 { grid-template-columns: 1fr; }

/* ---------- 指标卡 ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; box-shadow: var(--shadow); }
.stat .label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.stat .value { font-size: 21px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 11px; color: var(--muted); margin-top: 2px; }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* ---------- 表格 ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 11.5px; padding: 7px 9px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 8px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* 手机上用卡片代替表格；桌面才显示表格 */
.mobile-only { display: block; }
.desktop-only { display: none; }

.addr { word-break: break-all; max-width: 220px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* 窄屏下把「列很多」的表格改成一张张卡片，避免地址被挤成两行 */
@media (max-width: 699px) {
  table.stack-sm, table.stack-sm tbody { display: block; width: 100%; }
  table.stack-sm thead { display: none; }
  table.stack-sm tr {
    display: block; border: 1px solid var(--line); border-radius: 10px;
    padding: 10px 12px; margin-bottom: 8px; background: #fdfbf9;
  }
  table.stack-sm td {
    display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
    border: none; padding: 3px 0; text-align: right;
  }
  table.stack-sm td::before {
    content: attr(data-label); color: var(--muted); font-size: 12px;
    text-align: left; flex: 0 0 auto;
  }
  table.stack-sm td.num { text-align: right; }
  table.stack-sm td .btn { white-space: nowrap; }
  /* 操作按钮独占一行 */
  table.stack-sm td.stretch { display: block; text-align: right; }
  table.stack-sm td.stretch::before { display: none; }
}

/* ---------- 订单状态标签栏 ---------- */
.status-tabs {
  display: flex; gap: 6px; margin-bottom: 12px;
  overflow-x: auto; padding-bottom: 2px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs a {
  flex: 0 0 auto; padding: 6px 12px; border-radius: 20px;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; font-size: 13px; white-space: nowrap;
}

/* ---------- 仪表盘区间切换 ---------- */
.period-tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  overflow-x: auto; padding-bottom: 2px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }
.period-tabs a {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 20px;
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  text-decoration: none; font-size: 13px; white-space: nowrap;
}
.period-tabs a:hover { border-color: var(--accent); color: var(--accent); }
.period-tabs a.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.status-tabs a span {
  display: inline-block; margin-left: 4px; padding: 0 6px;
  background: var(--bg); border-radius: 10px; font-size: 11.5px;
}
.status-tabs a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.status-tabs a.on span { background: rgba(255, 255, 255, .25); }

.searchbar { display: flex; gap: 8px; padding: 12px 14px; }
.searchbar input { flex: 1; }

/* ---------- 手机订单卡片 ---------- */
.ocard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 13px 14px; margin-bottom: 10px;
}
.ocard-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ocard-head .muted { margin-left: auto; }
.ocard-who { font-size: 14px; margin-bottom: 6px; }
.ocard-items {
  font-size: 13px; color: var(--muted);
  border-top: 1px dashed var(--line); padding-top: 7px; margin-bottom: 6px;
}
.ocard-ship { font-size: 12.5px; color: var(--info); margin-bottom: 6px; }
.ocard-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px;
}
.ocard-actions { display: flex; gap: 6px; margin-left: auto; }
.ocard-total {
  display: flex; gap: 14px; font-weight: 600; background: #fdfaf6;
}

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 20px;
  font-size: 11.5px; background: var(--accent-soft); color: var(--accent); white-space: nowrap;
}
.tag.grey { background: #f0ece7; color: var(--muted); }
.tag.green { background: #e6f4ee; color: var(--good); }
.tag.red { background: #fbeae6; color: var(--bad); }
.tag.yellow { background: #fbf3df; color: var(--warn); }
.tag.blue { background: #e8f0f8; color: var(--info); }
.tag.orange { background: #fdeee0; color: #b9702f; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 16px; /* 16px 可避免 iOS 自动放大 */
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; min-height: 62px; }
.field { margin-bottom: 12px; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 12px; }

/* ---------- 按钮：手机上够大，点得准 ---------- */
.btn {
  display: inline-block; padding: 9px 15px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none;
  text-align: center; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { opacity: .9; color: #fff; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head .actions .btn { flex: 0 0 auto; }

/* ---------- 订单明细行：手机上堆叠显示 ---------- */
.items-table thead { display: none; }
.items-table, .items-table tbody { display: block; width: 100%; }
.items-table tr {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; margin-bottom: 10px; background: #fdfbf9;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.items-table td { border: none; padding: 0; display: block; }
.items-table td:first-child,
.items-table td:nth-child(2) { grid-column: 1 / -1; }
.items-table td:last-child { grid-column: 1 / -1; text-align: left; }
.items-table td::before {
  content: attr(data-label);
  display: block; font-size: 11px; color: var(--muted); margin-bottom: 3px;
}
.items-table .line-total {
  text-align: left; padding-top: 6px; border-top: 1px dashed var(--line);
}
.items-table .line-total::before { content: "小计"; }

/* ---------- 提示条 ---------- */
.notice {
  padding: 10px 12px; border-radius: 9px; font-size: 12.5px;
  background: #fbf3df; color: #8a6a1f; border: 1px solid #f0e2c0; margin-bottom: 12px;
}
.notice.info { background: var(--accent-soft); color: #9c5a2f; border-color: #f5dccb; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

.footer {
  padding: 14px 16px calc(var(--tabbar-h) + var(--safe-b) + 16px);
  text-align: center; color: var(--muted); font-size: 11.5px;
  border-top: 1px solid var(--line);
}
.toast {
  margin-left: 10px; padding: 2px 10px; border-radius: 20px;
  background: var(--good); color: #fff; opacity: 0; transition: opacity .2s;
}
.toast.show { opacity: 1; }

code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }

/* ============================================================
   前台店铺（游客可见）
   ============================================================ */
.shop-body { background: var(--bg); padding-bottom: 0; }

.shop-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 16px; height: 52px;
  background: rgba(250, 247, 242, .95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.shop-brand { font-weight: 600; text-decoration: none; color: var(--ink); font-size: 15px; }
.shop-bar-right { display: flex; align-items: center; gap: 8px; }
.shop-cart {
  position: relative; text-decoration: none; color: var(--ink);
  font-size: 13.5px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; white-space: nowrap;
}
.shop-cart .badge {
  display: inline-block; margin-left: 4px; padding: 0 6px;
  background: var(--accent); color: #fff; border-radius: 10px; font-size: 11.5px;
}
/* 右上角的管理员入口：低调但要看得见 */
.shop-admin {
  text-decoration: none; color: var(--muted); font-size: 13px;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}
.shop-admin:hover { color: var(--accent); background: var(--accent-soft); }

.shop-wrap { max-width: 900px; margin: 0 auto; padding: 16px 14px 90px; }
.shop-title { margin-bottom: 14px; }
.shop-title h1 { font-size: 20px; }
.shop-hero { text-align: center; padding: 18px 0 10px; }
.shop-hero h1 { font-size: 23px; }
.shop-note { font-size: 13px; }

/* 商品网格 */
.shop-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) { .shop-grid { grid-template-columns: repeat(3, 1fr); } }

.pcard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.pcard-img {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; background: #f5efe8; text-decoration: none;
}
/* 还没传图时不要占一整块正方形 —— 手机上 8 个商品会拉得很长 */
.pcard-img.no-img { aspect-ratio: 2 / 1; }
.pcard-img img { width: 100%; height: 100%; object-fit: cover; }
.pcard-ph { font-size: 26px; opacity: .35; }
.pcard-body { padding: 10px 11px 6px; flex: 1; }
.pcard-name {
  display: block; font-weight: 600; color: var(--ink);
  text-decoration: none; font-size: 14px; margin-bottom: 2px;
}
.pcard-price {
  font-size: 17px; font-weight: 600; color: var(--accent);
  margin-top: 6px; font-variant-numeric: tabular-nums;
}

/* 点赞 / 下单数标签 */
.pcard-social {
  display: flex; align-items: center; gap: 6px;
  margin-top: 7px; flex-wrap: wrap;
}
.shop-social { margin: 10px 0 4px; }
.like-form { margin: 0; display: inline; }
.chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 20px; font-size: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-variant-numeric: tabular-nums; line-height: 1.5;
}
.chip.sold { cursor: default; }
.chip.like { cursor: pointer; font: inherit; font-size: 12px; }
.chip.like:hover { border-color: var(--accent); color: var(--accent); }
.chip.like.on {
  background: #fdeceb; border-color: #f3c9c5; color: #c2543f; font-weight: 500;
}

/* 「还差多少起订」按钮的禁用外观 —— 用 a 标签实现，不提交表单 */
.btn.disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
  background: var(--muted); border-color: var(--muted);
}
.center-note { text-align: center; margin: 4px 0 10px; }
.pcard-add { padding: 0 11px 11px; }
.pcard-add .btn { padding: 8px; font-size: 13.5px; }

/* ==========================================================
   彩旗公告（首页公告）
   一串小三角旗挂在绳子上，从左到右轻微摆动 —— 每面旗的
   animation-delay 由模板按序号算出来，所以是波浪而不是齐步走。
   ========================================================== */
.bunting {
  position: relative;
  margin: 2px 0 18px;
  padding-top: 40px;            /* 给旗子留出悬挂空间 */
  text-align: center;
}

/* 绳子：中间实、两端淡出，看起来像松弛地挂在那里 */
.bunting::before {
  content: "";
  position: absolute; top: 5px; left: 1%; right: 1%;
  height: 2px; border-radius: 2px;
  background: linear-gradient(90deg,
    rgba(214, 178, 140, 0) 0%,
    rgba(214, 178, 140, .85) 7%,
    rgba(214, 178, 140, .85) 93%,
    rgba(214, 178, 140, 0) 100%);
}

.bunting-flags {
  position: absolute; top: 6px; left: 1%; right: 1%;
  display: flex; justify-content: space-between;
  pointer-events: none;
}

/* 三角旗：用 clip-path 切出来，比 border 三角更好控制尺寸 */
.flag {
  width: 22px; height: 30px;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;      /* 从绳子那个点摆下来 */
  animation: flag-sway 2.8s ease-in-out infinite;
  will-change: transform;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .06));
}

/* 四色循环，取自店铺的暖色调 */
.flag.c0 { background: #f0a071; }
.flag.c1 { background: #f6c177; }
.flag.c2 { background: #e88b8b; }
.flag.c3 { background: #b8cf9a; }

/* 左右小幅摆动 + 轻微形变，像被风撩了一下 */
@keyframes flag-sway {
  0%, 100% { transform: rotate(-4deg) skewX(0deg); }
  25%      { transform: rotate(0deg)  skewX(2deg); }
  50%      { transform: rotate(4deg)  skewX(0deg); }
  75%      { transform: rotate(0deg)  skewX(-2deg); }
}

/* 旗子下面的公告文字，做成一条小绶带 */
.bunting-text {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8f0, #fdeee0);
  border: 1px solid #f0d9bf;
  color: #8a5a34;
  font-size: 14px; font-weight: 500;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(196, 140, 90, .10);
  animation: bunting-breathe 3.4s ease-in-out infinite;
}

/* 绶带缓慢呼吸，和旗子一起有「飘」的感觉 */
@keyframes bunting-breathe {
  0%, 100% { transform: translateY(0);    box-shadow: 0 2px 8px rgba(196, 140, 90, .10); }
  50%      { transform: translateY(-2px); box-shadow: 0 5px 14px rgba(196, 140, 90, .16); }
}

/* 手机：旗子小一点、稀一点，别把首屏顶下去 */
@media (max-width: 560px) {
  .bunting { padding-top: 34px; }
  .flag { width: 16px; height: 22px; }
  .bunting-text { font-size: 13px; padding: 8px 14px; }
  /* 16 面旗在小屏上太挤，隔一面藏一面 */
  .flag:nth-child(even) { display: none; }
}

/* 尊重「减少动态效果」的系统设置：关掉动画，只留静态彩旗 */
@media (prefers-reduced-motion: reduce) {
  .flag, .bunting-text { animation: none; }
  .flag { transform: rotate(-2deg); }
}

/* 商品详情 */
.shop-gallery {
  display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); margin-bottom: 12px;
}
.shop-gallery a { display: block; border-radius: 10px; overflow: hidden; }
.shop-gallery img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.shop-price {
  font-size: 26px; font-weight: 600; color: var(--accent);
  margin-bottom: 8px; font-variant-numeric: tabular-nums;
}
.shop-buy { margin-top: 14px; }
.qty-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.qty-row label { margin: 0; }
.qty-row input { max-width: 110px; }
.shop-meta { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: 13px; }
.shop-meta dt { color: var(--muted); white-space: nowrap; }
.shop-meta dd { margin: 0; word-break: break-word; }

/* 购物车 */
.cart-card { padding: 4px 14px; }
.cart-line {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.cart-line:last-child { border-bottom: none; }
.cart-thumb {
  flex: 0 0 50px; width: 50px; height: 50px; border-radius: 8px;
  overflow: hidden; background: #f5efe8; display: flex;
  align-items: center; justify-content: center;
}
.cart-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { flex: 1; min-width: 0; }
.cart-info a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14px; }
.cart-line-total { font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.cart-qty { flex: 0 0 78px; }
.cart-actions { margin: 10px 0 14px; }
.cart-total { padding: 14px; }
.ct-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 14px; }
.ct-grand { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 10px; font-size: 16px; }
.ct-grand strong { color: var(--accent); font-size: 19px; }
.shop-cta { padding: 13px; font-size: 16px; margin-bottom: 10px; }

/* 结算：选自提/邮寄 */
.pick-row { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.pick {
  display: block; margin: 0; cursor: pointer; padding: 14px 12px;
  border: 2px solid var(--line); border-radius: 11px;
  background: #fff; text-align: center;
}
.pick input { display: none; }
.pick.on { border-color: var(--accent); background: var(--accent-soft); }
.pick-t { display: block; font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.pick-d { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* 收款码 */
.pay-card { text-align: center; }
.qr-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.qr { margin: 0; }
.qr img {
  width: 190px; height: 190px; object-fit: contain;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 6px;
}
.qr figcaption { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.pay-amount { font-size: 14px; margin: 6px 0 0; }
.pay-amount strong { color: var(--accent); font-size: 22px; margin-left: 6px; }
.qr-preview { text-align: center; margin-bottom: 10px; }
.qr-preview img { max-width: 220px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }

.shop-foot { border-top: 1px solid var(--line); background: #fff; }
.shop-foot-in { max-width: 900px; margin: 0 auto; padding: 16px 14px 24px; font-size: 13px; }
.shop-foot p { margin: 0 0 8px; }

/* ---------- 记录卡片（模具 / 批次 / 样品） ---------- */
.rec-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .rec-grid { grid-template-columns: repeat(2, 1fr); } }

.rec {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; background: #fdfbf9;
}
.rec-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 8px; flex-wrap: wrap;
}
.rec-meta {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 10px;
  margin: 0 0 10px; font-size: 12.5px;
}
.rec-meta dt { color: var(--muted); white-space: nowrap; }
.rec-meta dd { margin: 0; word-break: break-word; }
.rec .gallery-empty { margin-bottom: 8px; }
.rec .upload-tile { width: 76px; height: 76px; font-size: 11px; }
.rec .upload-tile .up-icon { font-size: 19px; }

/* ---------- 图片相册 ---------- */
.gallery-grid {
  display: grid; gap: 8px; margin-bottom: 10px;
  grid-template-columns: repeat(3, 1fr);
}
@media (min-width: 700px) { .gallery-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1000px) { .gallery-grid { grid-template-columns: repeat(6, 1fr); } }

.shot {
  position: relative; margin: 0;
  aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden;
  background: #f2ece5; border: 1px solid var(--line);
}
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 3px 6px; font-size: 10.5px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot-del {
  position: absolute; top: 4px; right: 4px; margin: 0;
}
.shot-del button {
  width: 26px; height: 26px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 16px;
  line-height: 1; cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.shot-del button:hover { background: var(--bad); }

.gallery-empty { margin: 4px 0 10px; }
.upload-form { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.upload-tile {
  flex: 0 0 auto; width: 96px; height: 96px; margin: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 10px;
  background: #fdfbf9; color: var(--muted); font-size: 11.5px;
}
.upload-tile:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
/* 原生文件框藏起来，用整个方块当触发区 —— 手机上更好点 */
.upload-tile input[type="file"] { display: none; }
.upload-tile .up-icon { font-size: 22px; line-height: 1; }
.upload-caption { flex: 1 1 140px; min-width: 0; align-self: flex-end; }
.upload-hint { margin: 8px 0 0; line-height: 1.5; }

/* 列表页缩略图 */
.thumb-cell { width: 46px; }
.thumb-cell img {
  width: 42px; height: 42px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--line); display: block;
}
.thumb-none {
  width: 42px; height: 42px; border-radius: 8px;
  border: 1px dashed var(--line); display: flex;
  align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; background: #fdfbf9;
}

/* ---------- 登录 / 密码页 ---------- */
.auth-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #faf7f2 0%, #f6ece3 100%);
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
  padding: 28px 24px;
}
.auth-brand { text-align: center; font-weight: 600; margin-bottom: 20px; }
.auth-brand .logo { font-size: 26px; }
.auth-card h1 { font-size: 19px; text-align: center; margin-bottom: 4px; }
.auth-card .sub { text-align: center; margin-bottom: 20px; line-height: 1.5; }
.auth-links { text-align: center; margin-top: 16px; }
.auth-links a { color: var(--accent); text-decoration: none; font-size: 13px; }
.btn.block { display: block; width: 100%; padding: 11px; font-size: 15px; }

/* 店铺设置推到导航最右侧，与其它业务菜单分开一点 */
.nav a.nav-right { margin-left: auto; }
@media (max-width: 900px) {
  .nav a.nav-right { margin-left: 0; }
}

/* 登录页里的配置指引 */
.setup-help {
  margin-top: 14px; padding: 12px 14px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 10px; background: #fdfbf9;
}
.setup-help summary {
  cursor: pointer; font-weight: 600; color: var(--accent);
  list-style: none; outline: none;
}
.setup-help summary::-webkit-details-marker { display: none; }
.setup-help summary::before { content: "▸ "; }
.setup-help[open] summary::before { content: "▾ "; }
.setup-help ol { margin: 10px 0 8px; padding-left: 20px; line-height: 1.75; }
.setup-help li { margin-bottom: 4px; }

/* ---------- 右上角账号 ---------- */
.usermenu { display: flex; align-items: center; gap: 8px; }
.usermenu form { margin: 0; }
.userchip {
  padding: 5px 10px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-size: 13.5px; white-space: nowrap;
}
.userchip:hover { background: var(--accent-soft); color: var(--accent); }
.footlink { color: var(--muted); text-decoration: none; }
.footlink:hover { color: var(--accent); }

/* ============================================================
   平板
   ============================================================ */
@media (min-width: 700px) {
  .grid.k4 { grid-template-columns: repeat(4, 1fr); }
  .field-row { grid-template-columns: repeat(3, 1fr); }
  .addr-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* ============================================================
   桌面：换成顶部导航、恢复表格
   ============================================================ */
@media (min-width: 900px) {
  :root { --tabbar-h: 0px; }

  .topbar { height: 58px; padding: 0 20px; }
  .nav { display: flex; gap: 4px; }
  .nav a {
    padding: 6px 12px; border-radius: 8px;
    color: var(--muted); text-decoration: none; font-size: 14px;
  }
  .nav a:hover { background: var(--accent-soft); color: var(--accent); }
  .nav a.active { background: var(--accent); color: #fff; font-weight: 500; }
  .tabbar { display: none; }

  .wrap { padding: 22px 20px 60px; }
  .grid.k3 { grid-template-columns: repeat(3, 1fr); }
  .grid.k2 { grid-template-columns: repeat(2, 1fr); }
  .mobile-only { display: none; }
  .desktop-only { display: block; }

  .card { padding: 18px; }
  h1 { font-size: 21px; }
  .stat .value { font-size: 25px; }
  input, select, textarea { font-size: 14px; }   /* 有鼠标，不用防 iOS 缩放 */
  .addr { max-width: 260px; }

  /* 明细行恢复成表格 */
  .items-table, .items-table tbody { display: table; }
  .items-table thead { display: table-header-group; }
  .items-table tr { display: table-row; border: none; padding: 0; background: none; margin: 0; }
  .items-table td { display: table-cell; padding: 6px 8px; border-bottom: 1px solid var(--line); }
  .items-table td::before { content: none; }
  .items-table td:first-child { min-width: 190px; }
  .items-table td:last-child { text-align: right; }
  .items-table .line-total { text-align: right; padding: 6px 8px; border: none; }
}