:root {
  --bg: #f4f6f6; --card: #fff; --line: #e5e9ea; --text: #17212b; --sub: #667085; --muted: #98a2b3;
  --pri: #0d9488; --pri-2: #0f766e; --pri-soft: #e6f5f3; --ok: #16a34a; --ok-soft: #e8f6ee; --warn: #d97706; --warn-soft: #fdf3e2;
  --bad: #dc2626; --bad-soft: #fdecec; --r: 12px; --nav-h: 58px; --jd: #e1251b;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .03);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; -webkit-text-size-adjust: 100%; }
a { color: var(--pri); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pri-soft); border-color: var(--pri); }
textarea { resize: vertical; min-height: 64px; }
.boot { padding: 80px 0; text-align: center; color: var(--sub); }

/* 布局：电脑左侧导航，手机底部导航 */
.shell { display: flex; min-height: 100vh; }
.side { width: 208px; flex: none; background: #fff; border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .brand { font-weight: 700; font-size: 16px; padding: 4px 10px 16px; display: flex; align-items: center; gap: 8px; }
.side .brand img { border-radius: 6px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); margin-bottom: 2px; }
.side a:hover { background: var(--bg); }
.side a.on { background: var(--pri-soft); color: var(--pri); font-weight: 600; }
.side .badge { margin-left: auto; }
.side .foot { margin-top: auto; color: var(--muted); font-size: 12px; padding: 0 10px; }
.main { flex: 1; min-width: 0; padding: 20px 24px 40px; max-width: 1200px; }
.bnav { display: none; }
.page-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-h h1 { font-size: 20px; margin: 0; flex: 1; min-width: 120px; }
.back { color: var(--sub); font-size: 13px; }

@media (max-width: 760px) {
  .side { display: none; }
  .main { padding: 12px 12px calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
  .bnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bnav a { flex: 1; height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--sub); font-size: 11px; position: relative; }
  .bnav a.on { color: var(--pri); }
  .bnav a svg { width: 22px; height: 22px; }
  .bnav .badge { position: absolute; top: 5px; left: calc(50% + 6px); }
  .page-h h1 { font-size: 18px; }
  input, select, textarea { font-size: 16px; } /* iPhone 输入框小于 16px 会自动放大页面 */
  .pc { display: none !important; }
}
@media (min-width: 761px) { .mo { display: none !important; } }

/* 通用组件 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; }
.card h2 { font-size: 15px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card h2 .sub { font-weight: 400; }
.sub { color: var(--sub); font-size: 13px; }
.muted { color: var(--muted); font-size: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer; white-space: nowrap; min-height: 36px; }
.btn:hover { border-color: #cfd3da; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 10px; min-height: 28px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--pri); padding: 0 4px; min-height: 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--bg); color: var(--sub); white-space: nowrap; }
.chip.feedback { background: var(--warn-soft); color: var(--warn); }
.chip.preparing { background: var(--pri-soft); color: var(--pri); }
.chip.shipping { background: #efe9fd; color: #6d3fd8; }
.chip.receiving { background: #e3f4f7; color: #0e7f91; }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.demo { background: #f1f1f1; color: #888; }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.red { color: var(--bad); } .green { color: var(--ok); } .orange { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; }
.notice { background: var(--warn-soft); color: #8a5300; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.seg { display: inline-flex; background: #eceef1; border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: 6px; cursor: pointer; color: var(--sub); white-space: nowrap; }
.seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.seg-scroll .seg { flex-wrap: nowrap; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 260px; }
.grid { display: grid; gap: 10px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.form label, .fl { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--sub); }
.form .full { grid-column: 1 / -1; }

/* 数字卡片 */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; display: block; color: var(--text); }
.tile .n { font-size: 26px; font-weight: 700; line-height: 1.2; }
.tile .l { color: var(--sub); font-size: 13px; }
.tile.hot { border-color: #f3b6b1; background: #fff8f7; }
.tile.hot .n { color: var(--bad); }
.kpis { display: flex; gap: 24px; flex-wrap: wrap; }
.kpis .k b { font-size: 20px; display: block; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, 1fr); } .tile .n { font-size: 22px; } .kpis { gap: 16px; } }

/* 采购单列表 */
.po { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); cursor: pointer; }
.po:last-child { border-bottom: 0; }
.po:hover { background: #fafbfc; }
.po .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.po .r { text-align: right; white-space: nowrap; }
.po .alerts { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.list { background: #fff; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.bar { height: 6px; background: #eceef1; border-radius: 3px; overflow: hidden; display: flex; min-width: 80px; }
.bar i { display: block; height: 100%; background: var(--pri); }
.bar i.r { background: var(--ok); }
.prog { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; }
.prog .bar { flex: 1; }

/* 表格 */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--sub); background: #fafbfc; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl tfoot td { font-weight: 600; background: #fafbfc; }
@media (max-width: 760px) {
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-bottom: 1px solid var(--line); padding: 8px 2px; }
  table.cards td { border: 0; padding: 2px 4px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.cards td::before { content: attr(data-l); color: var(--sub); text-align: left; flex: none; }
  table.cards td.main-cell { display: block; text-align: left; font-weight: 600; }
  table.cards td.main-cell::before { content: none; }
  table.cards tfoot { display: block; }
}

/* 进度步骤 */
.steps { display: flex; gap: 0; margin: 4px 0 6px; }
.step { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); }
.step::before { content: ""; position: absolute; top: 11px; left: -50%; right: 50%; height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step .dot { width: 24px; height: 24px; border-radius: 50%; background: #eceef1; color: var(--muted); display: flex; align-items: center; justify-content: center; margin: 0 auto 4px; position: relative; font-size: 12px; font-weight: 700; }
.step.done { color: var(--text); } .step.done .dot { background: var(--ok); color: #fff; } .step.done::before { background: var(--ok); }
.step.cur { color: var(--pri); font-weight: 600; } .step.cur .dot { background: var(--pri); color: #fff; } .step.cur::before { background: var(--ok); }
.step small { display: block; color: var(--muted); font-weight: 400; }
.sums { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.sums div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.sums b { display: block; font-size: 18px; }
.sums span { color: var(--sub); font-size: 12px; }
@media (max-width: 760px) { .sums { grid-template-columns: repeat(3, 1fr); } .step { font-size: 11px; } }

/* 反馈 / 出库录入行 */
.fb-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.fb-row:last-child { border-bottom: 0; }
.fb-row .ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.fb-row input.q { width: 90px; }
.fb-row .extra { grid-column: 1 / -1; }
.av button.on[data-v=yes] { background: var(--ok); color: #fff; }
.av button.on[data-v=part] { background: var(--warn); color: #fff; }
.av button.on[data-v=no] { background: var(--bad); color: #fff; }
@media (max-width: 760px) { .fb-row { grid-template-columns: 1fr; } .fb-row .ctl { justify-content: flex-start; } }

/* 出库记录 */
.ship { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.ship .h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ship .h .sp { flex: 1; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); cursor: zoom-in; }
.hist { font-size: 13px; }
.hist div { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.hist div:last-child { border: 0; }

/* 柱状图 */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding: 8px 0 0; overflow-x: auto; }
.chart .c { flex: 1 0 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 14px; }
.chart .c i { display: block; width: 100%; max-width: 34px; background: var(--pri); border-radius: 3px 3px 0 0; min-height: 1px; }
.chart .c span { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; }

/* 弹窗、提示 */
.mask { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 860px; }
.modal .mh { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; display: flex; align-items: center; }
.modal .mh .x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--sub); }
.modal .mb { padding: 14px 18px; overflow-y: auto; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 760px) {
  .mask { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: none; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .modal .mf { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .modal .mf .btn { flex: 1; }
}
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); background: #1d2129; color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 3000; max-width: calc(100vw - 32px); display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.toast.err { background: var(--bad); }
.toast button { border: 1px solid rgba(255,255,255,.6); background: none; color: #fff; border-radius: 6px; padding: 2px 8px; cursor: pointer; }
.imgview { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.imgview img { max-width: 96vw; max-height: 92vh; }

/* 登录 */
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; }
.login h1 { font-size: 22px; margin: 0 0 4px; }
.login .card { padding: 20px; }
.login label { display: block; margin-bottom: 12px; color: var(--sub); font-size: 13px; }
.login label input { margin-top: 4px; }
.login .btn { width: 100%; margin-top: 4px; }

/* 箱码标签：屏幕上预览，打印时 A4 每页 3 列 × 4 行 = 12 张 */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.label { background: #fff; border: 1px dashed #c9ced6; border-radius: 6px; padding: 8px; display: flex; gap: 8px; align-items: center; break-inside: avoid; page-break-inside: avoid; }
.label .qr { flex: none; width: 96px; height: 96px; }
.label .qr img, .label .qr canvas { width: 96px !important; height: 96px !important; }
.label .lt { font-size: 12px; line-height: 1.4; min-width: 0; word-break: break-all; }
.label .lt b { font-size: 20px; display: block; }
@media print {
  @page { size: A4; margin: 8mm; }
  html, body { background: #fff; }
  .side, .bnav, .no-print, .toast { display: none !important; }
  .main { padding: 0; max-width: none; }
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { height: 66mm; border: 1px dashed #999; flex-direction: column; justify-content: center; text-align: center; }
  .label .qr, .label .qr img, .label .qr canvas { width: 36mm !important; height: 36mm !important; }
  .label .lt { font-size: 10pt; }
  .label .lt b { font-size: 18pt; }
}

/* ───────── 模块：销售额预警（tx- 前缀） ───────── */
.chip.tx-over { background: #fde2e2; color: #991b1b; font-weight: 600; }
.chip.tx-red { background: #fdecec; color: #dc2626; }
.chip.tx-yellow { background: #fef6d8; color: #9a6b00; }
.chip.tx-blue { background: #e8efff; color: #2563eb; }
.chip.tx-green { background: #e6f6ec; color: #16a34a; }
.tx-sum { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tx-sum span { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: 13px; }
.tx-sum b { font-size: 16px; }
.tx-cos { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
@media (max-width: 760px) { .tx-cos { grid-template-columns: 1fr; } }
.tx-co { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer; }
.tx-co:hover { border-color: #cfd3da; }
.tx-co.tx-over { border-color: #f3b2b2; background: #fffafa; }
.tx-co.tx-red { border-color: #f6c4c4; }
.tx-co .h { display: flex; align-items: center; gap: 8px; }
.tx-co .h b { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-co .big { margin: 8px 0 2px; display: flex; align-items: baseline; gap: 6px; }
.tx-co .big strong { font-size: 26px; line-height: 1.1; }
.tx-co .foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.tx-co .warn { margin-top: 6px; font-size: 12px; color: #9a6b00; }
.tx-co .warn.bad { color: #991b1b; }
.tx-meter { position: relative; height: 14px; background: #eceef1; border-radius: 7px; margin: 18px 0 10px; }
.tx-meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 7px; max-width: 100%; }
.tx-meter .fill.tx-green { background: #16a34a; } .tx-meter .fill.tx-blue { background: #2563eb; } .tx-meter .fill.tx-yellow { background: #eab308; }
.tx-meter .fill.tx-red { background: #dc2626; } .tx-meter .fill.tx-over { background: #991b1b; }
.tx-meter .tick { position: absolute; top: -5px; bottom: -5px; width: 2px; border-radius: 1px; }
.tx-meter .tick span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 10px; white-space: nowrap; color: var(--sub); }
.tx-meter .tick.b { background: #2563eb; } .tx-meter .tick.y { background: #eab308; } .tx-meter .tick.r { background: #dc2626; } .tx-meter .tick.l { background: var(--text); }
.tx-entry { display: grid; grid-template-columns: 1fr 200px 110px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tx-entry:last-of-type { border-bottom: 0; }
.tx-entry .w { font-size: 13px; color: var(--sub); text-align: right; }
@media (max-width: 760px) { .tx-entry { grid-template-columns: 1fr 1fr; } .tx-entry .nm { grid-column: 1 / -1; } }
.tx-monthbar { display: flex; align-items: center; gap: 8px; }
.tx-monthbar input { width: auto; }
.tx-chart svg { width: 100%; height: auto; display: block; }
.tx-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--sub); margin-top: 6px; }
.tx-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ───────── 装到手机桌面后像 App ───────── */
html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: contain; }
a, button, .po, .tile, .seg button, .bnav a { touch-action: manipulation; }
.bnav, .side, .btn, .seg, .chip, .tile .l, .page-h h1 { -webkit-user-select: none; user-select: none; }
.bnav a { -webkit-touch-callout: none; }
/* 按下去有反馈，像原生 App */
.btn:active:not(:disabled) { transform: scale(.97); opacity: .85; }
.po:active, .tile:active, .list a.po:active { background: #f0f2f5; }
.bnav a:active svg { transform: scale(.9); }
.btn, .bnav a svg { transition: transform .08s, opacity .08s; }
/* 启动画面 */
.splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--bg); font-size: 17px; letter-spacing: 1px; }
.splash img { border-radius: 18px; box-shadow: 0 10px 30px rgba(13, 148, 136, .25); animation: splash-in .35s ease-out; }
@keyframes splash-in { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
/* 骨架屏：数据没到之前先占位，不出现「加载中…」白屏 */
.skel { display: grid; gap: 12px; padding-top: 4px; }
.skel i, .skel b { display: block; height: 18px; border-radius: 8px; background: linear-gradient(90deg, #eceef1 25%, #f5f6f8 50%, #eceef1 75%); background-size: 200% 100%; animation: skel 1.2s infinite; }
.skel b { height: 64px; border-radius: var(--r); }
.skel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
/* 页面切换淡入 */
.main > * { animation: page-in .18s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* 下拉刷新 */
.ptr { position: fixed; left: 50%; top: env(safe-area-inset-top); transform: translate(-50%, -48px); z-index: 2500; background: #fff; color: var(--sub); border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.12); padding: 6px 14px; font-size: 13px; display: flex; gap: 8px; align-items: center; transition: transform .15s; pointer-events: none; }
.ptr .spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--pri); border-radius: 50%; }
.ptr.loading .spin { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* 断网提示 */
.net-bar { position: fixed; left: 0; right: 0; top: 0; z-index: 2600; background: var(--warn); color: #fff; text-align: center; font-size: 13px; padding: calc(4px + env(safe-area-inset-top)) 12px 4px; }
.toast { top: calc(18px + env(safe-area-inset-top)); }
@media (max-width: 760px) {
  /* 底部导航：半透明毛玻璃，选中项更醒目 */
  .bnav { background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); }
  .bnav a.on svg { stroke-width: 2.2; }
  /* 弹窗按键盘弹出后的可视高度排，保存按钮不被挡 */
  .modal, .modal.wide { max-height: calc(var(--app-h, 100dvh) - 10px); }
  .modal .mb { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .main { padding-top: calc(12px + env(safe-area-inset-top)); }
  .standalone .login { margin-top: calc(10vh + env(safe-area-inset-top)); }
}


/* ───────── 视觉设计（果然简单）：青绿品牌色、模块分组侧栏、轻阴影卡片 ───────── */
body { font-feature-settings: "tnum"; }
.card, .list, .tile, .tx-co { border-color: var(--line); box-shadow: var(--shadow); }
.btn { border-radius: 9px; }
.btn.primary { background: var(--pri); border-color: var(--pri); box-shadow: 0 1px 2px rgba(13, 148, 136, .25); }
.btn.primary:hover { background: var(--pri-2); border-color: var(--pri-2); }
input:focus, select:focus, textarea:focus { outline: 3px solid var(--pri-soft); }
.page-h h1 { font-size: 21px; font-weight: 650; letter-spacing: .2px; }
.tile .n { font-weight: 650; }
.tile.hot { background: #fff; border-color: var(--line); box-shadow: inset 3px 0 0 var(--bad), var(--shadow); }
.notice { border-radius: 10px; }

/* 侧栏：品牌 + 按模块分组 + 底部个人卡片 */
.side { width: 220px; padding: 18px 12px 12px; background: #fff; }
.side .brand { padding: 2px 8px 18px; gap: 10px; align-items: center; }
.side .brand img { border-radius: 8px; box-shadow: 0 4px 10px rgba(13, 148, 136, .25); }
.side .brand b { display: block; font-size: 16px; line-height: 1.2; }
.side .brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 2px; }
.side-nav { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.side .grp { font-size: 11px; color: var(--muted); padding: 14px 10px 6px; letter-spacing: 1px; }
.side .grp:first-child { padding-top: 2px; }
.side a { padding: 8px 10px; color: #344054; font-size: 14px; }
.side a svg { color: #98a2b3; flex: none; }
.side a:hover { background: #f2f4f5; }
.side a.on { background: var(--pri-soft); color: var(--pri-2); }
.side a.on svg { color: var(--pri); }
.side .foot { margin-top: 10px; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.side .foot:hover { background: #f8fafa; }
.side .foot b { display: block; font-weight: 600; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .foot small { display: block; color: var(--muted); font-size: 11px; }
.ava { width: 30px; height: 30px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.main { padding: 24px 32px 48px; }

/* 登录页：电脑左右分栏（左品牌、右表单），手机上下排 */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 480px); }
.login-hero { background: radial-gradient(120% 90% at 0% 0%, #2dd4bf 0%, #0d9488 45%, #0f766e 100%); color: #fff; padding: 12vh 8vw; display: flex; flex-direction: column; }
.login-hero img { border-radius: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); outline: 3px solid rgba(255, 255, 255, .35); }
.login-hero h1 { font-size: 34px; margin: 22px 0 6px; letter-spacing: 2px; }
.login-hero p { margin: 0; opacity: .85; font-size: 15px; }
.login-hero ul { list-style: none; padding: 0; margin: 40px 0 0; display: grid; gap: 12px; font-size: 14px; opacity: .92; }
.login-hero li::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #fff; margin-right: 10px; vertical-align: middle; opacity: .8; }
.login-form { align-self: center; padding: 40px 48px; display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { margin: 0 0 6px; font-size: 22px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--sub); }
.login-form input { padding: 11px 12px; border-radius: 10px; }
.login-form .btn { padding: 11px; font-size: 15px; margin-top: 6px; }
.login-form .muted { margin: 2px 0 0; text-align: center; }
@media (max-width: 760px) {
  .login-wrap { grid-template-columns: 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }
  .login-hero { padding: calc(56px + env(safe-area-inset-top)) 24px 36px; align-items: center; text-align: center; border-radius: 0 0 28px 28px; }
  .login-hero img { width: 60px; height: 60px; }
  .login-hero h1 { font-size: 26px; margin-top: 16px; }
  .login-form { align-self: start; padding: 28px 24px; }
  .login-form h2 { display: none; }
  .main { padding: calc(14px + env(safe-area-inset-top)) 14px calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); }
  .tile.hot { box-shadow: inset 3px 0 0 var(--bad), var(--shadow); }
}

/* 「京东」标签：这套系统就是做京东业务的，处处点明 */
.jd-tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; margin-right: 6px; border-radius: 4px; background: var(--jd); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: 1px; vertical-align: 2px; line-height: 1; }
h1 .jd-tag { height: 22px; font-size: 13px; padding: 0 7px; vertical-align: 3px; }
.jd-tag.on-dark { background: #fff; color: var(--jd); }
.side .brand small { display: flex; align-items: center; }
.side .brand small .jd-tag { height: 16px; font-size: 10px; padding: 0 4px; margin-right: 4px; vertical-align: 0; }
.splash small { color: var(--sub); font-size: 13px; letter-spacing: 1px; margin-top: -6px; }

/* ───────── 登录后的品牌：顶栏 + 品牌色数据卡 ───────── */
.col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.col .main { width: 100%; }
.topbar { position: sticky; top: 0; z-index: 45; display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 32px; background: rgba(255, 255, 255, .86); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
.tb-brand { display: none; align-items: center; gap: 8px; color: var(--text); }
.tb-brand img { border-radius: 7px; }
.tb-brand b { font-size: 16px; letter-spacing: .5px; }
.tb-brand .jd-tag { margin: 0; height: 17px; font-size: 10px; padding: 0 5px; }
.tb-crumb { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.tb-crumb i { font-style: normal; color: #d0d5dd; }
.tb-crumb b { color: var(--text); font-weight: 600; font-size: 14px; }
.tb-date { margin-left: auto; color: var(--sub); font-size: 13px; }
.tb-user { display: none; }
/* 首页数据卡：品牌青绿渐变，进门第一眼就是「果然简单」 */
.brand-card { background: radial-gradient(130% 140% at 0% 0%, #14b8a6 0%, #0d9488 45%, #0f766e 100%); border: 0; color: #fff; box-shadow: 0 6px 18px rgba(13, 148, 136, .22); position: relative; overflow: hidden; }
.brand-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; border: 26px solid rgba(255, 255, 255, .08); pointer-events: none; }
.brand-card .sub, .brand-card .muted { color: rgba(255, 255, 255, .78); }
.brand-card .kpis b { color: #fff; }
@media (max-width: 760px) {
  .topbar { height: calc(50px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; gap: 10px; }
  .tb-brand { display: flex; }
  .tb-crumb, .tb-date { display: none; }
  .tb-user { display: flex; margin-left: auto; }
  .tb-user .ava { width: 30px; height: 30px; }
  .main { padding-top: 12px; }
  .ptr { top: calc(50px + env(safe-area-inset-top)); }
}
.brand-card .bc-h { font-size: 12px; letter-spacing: 1px; color: rgba(255, 255, 255, .8); margin-bottom: 8px; }

/* 导入表格：文件按钮（输入框不用 display:none，部分 iPhone 版本点了没反应）+ 粘贴区 */
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; font-size: 100px; }
.tp { margin: 10px 0; }
.tp-paste textarea { font-size: 13px; font-family: ui-monospace, Menlo, monospace; }

/* 左右滑动切换分类：新页面从滑动的方向进来 */
[data-slide=l] .main > * { animation: slide-l .22s ease-out; }
[data-slide=r] .main > * { animation: slide-r .22s ease-out; }
@keyframes slide-l { from { opacity: .3; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes slide-r { from { opacity: .3; transform: translateX(-36px); } to { opacity: 1; transform: none; } }
.tp-drop { border: 2px dashed #c9d3d6; border-radius: 12px; padding: 22px 16px; text-align: center; color: var(--sub); margin: 10px 0; background: #fafcfc; transition: background .15s, border-color .15s; }
.tp-drop.on { border-color: var(--pri); background: var(--pri-soft); color: var(--pri-2); }
.tp-help { margin-top: 8px; font-size: 13px; }
.tp-help summary { cursor: pointer; color: var(--pri-2); }
.tp-help ol { padding-left: 18px; margin: 4px 0 0; display: grid; gap: 6px; color: var(--text); }
.tp-inbox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; background: #f7fbfa; }
.tp-ih { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.tp-it { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); }
.tp-it:first-child { border-top: 0; }
.tp-it span { flex: 1; min-width: 0; }
.tp-it b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-it small { color: var(--muted); font-size: 12px; }
.tp-it.used b { color: var(--sub); }

/* 开发者水印：右下角常驻，半透明，不影响点击；打印箱码标签时不出现 */
.devmark { position: fixed; right: 14px; bottom: 10px; z-index: 40; pointer-events: none; user-select: none; -webkit-user-select: none;
  font-size: 12px; font-weight: 650; letter-spacing: .08em; color: rgba(15, 118, 110, .45);
  padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .6); border: 1px solid rgba(13, 148, 136, .2); backdrop-filter: blur(2px); }
.devmark::before { content: "Dev · "; font-weight: 500; opacity: .75; }
@media print { .devmark { display: none !important; } }
@media (max-width: 760px) { .devmark { bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); right: 8px; font-size: 11px; } }

/* 问题反馈入口：电脑在侧栏底部，手机在顶栏右侧 */
.side .fb-side { margin-top: 10px; justify-content: center; border: 1px dashed rgba(13, 148, 136, .45); color: var(--pri-2); font-size: 13px; }
.side .fb-side:hover { background: var(--pri-soft); }
.tb-fb { white-space: nowrap; margin-left: 16px; font-size: 13px; color: var(--pri-2); border: 1px solid rgba(13, 148, 136, .35); border-radius: 999px; padding: 3px 12px; }
.tb-fb:hover { background: var(--pri-soft); }
@media (max-width: 760px) { .tb-fb { margin-left: auto; font-size: 12px; padding: 3px 10px; } .tb-user { margin-left: 8px; } }

/* 出错提示条上的「反馈这个问题」和关闭按钮 */
.toast { width: max-content; } /* 居中定位时默认只能占半屏宽，手机上字会被挤成一列 */
.toast button { white-space: nowrap; flex: none; }
.toast button.x { border: 0; background: none; color: inherit; font-size: 18px; line-height: 1; padding: 0 2px; opacity: .8; }
.fb-link { font-size: 13px; color: var(--pri-2); text-decoration: underline; text-underline-offset: 2px; }

/* 采购单标题前的批次（如「xggc发货表10.20+」） */
.po-batch { color: var(--pri-2); font-weight: 600; }

/* 系统更新提醒 */
.news + .news { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.news b { font-size: 15px; margin-right: 8px; }
.news p { margin: 6px 0 0; line-height: 1.65; color: var(--text); }
/* 顶栏在很窄的屏幕上别把「果然简单」挤成两行 */
.tb-brand b { white-space: nowrap; }
@media (max-width: 350px) { .tb-fb { font-size: 11px; padding: 3px 7px; } .tb-brand .jd-tag { display: none; } }

/* 采购单品牌：标题前的小标签、左侧「采购单」下的品牌分类 */
.brand-chip { background: #fff4e5; color: #b45309; border: 1px solid #fcd9a8; margin-right: 6px; font-weight: 600; }
.side .brand-nav { margin: 0 0 4px 30px; border-left: 1px solid var(--line); padding-left: 6px; }
.side .brand-nav a { display: block; padding: 5px 10px; font-size: 13px; color: var(--sub); border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .brand-nav a:hover { background: #f2f4f5; }
.side .brand-nav a.on { background: var(--pri-soft); color: var(--pri-2); font-weight: 600; }

/* 采购单列表前面的勾选框（像邮件一样）和上面的批量操作栏 */
.po.sel { grid-template-columns: 30px 1fr auto; }
.po.sel .ck { grid-column: 1; grid-row: 1 / span 4; align-self: center; }
.po.sel .prog, .po.sel .alerts { grid-column: 2 / -1; }
.ck { display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 6px 4px; margin: -6px 0; }
.ck input { width: 18px; height: 18px; margin: 0; accent-color: var(--pri); cursor: pointer; }
.sel-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; flex-wrap: wrap; }
.sel-bar .ck { width: 30px; justify-content: flex-start; margin-right: -4px; }
.sel-bar .btns { margin-left: auto; }
.sel-bar .btn:disabled { opacity: .45; }

/* SKU 汇总表：一级行可点开，二级是采购单明细 */
.sum-tbl .sum-l1 { cursor: pointer; font-weight: 600; }
.sum-tbl .sum-l1:hover { background: #fafbfc; }
.sum-tbl .tog { display: inline-block; width: 16px; color: var(--sub); font-weight: 400; }
.sum-tbl .sum-l2 td { background: #f8fafb; font-size: 13px; }
.sum-tbl .sum-l2 td:first-child { padding-left: 28px; }
.sum-tbl .sum-total td { border-top: 2px solid var(--line); }

/* 汇总表页面：批次是一级标题，下面是这批的采购单 */
.sum-batch { padding: 14px 16px; }
.sum-batch .sb-h { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.sum-batch h2 { margin: 0 0 4px; font-size: 18px; }
.sum-batch .sb-h .sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sum-batch .sb-pos { margin-top: 10px; border-top: 1px solid var(--line); }
.sum-batch .sb-po { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 4px 9px 18px; border-bottom: 1px dashed var(--line); color: var(--text); font-size: 14px; }
.sum-batch .sb-po:last-child { border-bottom: 0; }
.sum-batch .sb-po:hover { background: #fafbfc; }
.sum-batch .sb-po .num { margin-left: auto; color: var(--sub); }

/* 导入预览：SKU 汇总是主体，采购单明细折叠在下面；汇总表页每批先放汇总、再列采购单 */
.sum-block .tbl-wrap { max-height: 55vh; overflow: auto; }
.pv-h { margin: 14px 0 8px; font-size: 16px; }
details.pv-pos, details.sb-sum { margin-top: 10px; }
details.pv-pos > summary, details.sb-sum > summary { cursor: pointer; font-weight: 600; padding: 8px 0; color: var(--pri-2); }
.sb-sum-body { padding: 4px 0 6px; }
.sum-batch .sb-sub { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--sub); }
