.sale-create-modal { width: min(960px, calc(100% - 24px)); }
/* 手机上跟其他二级页面一样贴底铺满：留那 24px 缝隙只会让这一张看起来比别的窗窄一截 */
@media (max-width: 899px) { .sale-create-modal { width: 100%; } }
.sale-create-content { padding: 24px; }
.sale-editor { display: grid; gap: 24px; padding: 0; margin: 0; border: 0; min-width: 0; }
.sale-editor > .eye-form, .sale-editor > .photo-block { margin: 0; }
.sale-review { display: grid; gap: 24px; min-width: 0; }
.sale-create-modal [hidden] { display: none !important; }
.sale-create-modal .btn, .sale-create-modal .app-input { min-height: 44px; }
.sale-create-modal .app-input { width: 100%; min-width: 0; }
.sale-create-modal label > span { display: block; margin-bottom: 6px; font-size: 14px; color: var(--app-text-secondary); }
.sale-create-head h2 { flex: 1; min-width: 0; }
.sale-create-titlebar { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 12px 20px; min-width: 0; }
.sale-create-titlebar h2 { flex: 1 1 180px; }
.sale-create-titlebar > .app-segment, .sale-new-customer .app-segment {
  display: inline-grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  width: fit-content; max-width: 100%; justify-self: start;
}
.sale-create-titlebar .app-segment-tab, .sale-new-customer .app-segment-tab {
  min-width: 64px; padding-inline: 12px; text-align: center;
}
/* 业务分区与字段内部各有固定节奏，隐藏区不留空白。 */
.sale-section { display: grid; gap: 16px; margin: 0; padding-top: 24px; border-top: 1px solid var(--app-line); min-width: 0; }
.sale-section:first-child { padding-top: 0; border-top: 0; }
.sale-section h3, .sale-review h3 { font-size: 18px; margin: 0; font-weight: 600; }
.sale-section-title { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0; }
.sale-section-title h3 { margin: 0; }
.sale-customer-pick { display: grid; gap: 16px; min-width: 0; }
.sale-search { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }
.sale-search .app-input { flex: 1 1 200px; width: auto; }
.sale-customer-selected { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 16px; }
.sale-customer-selected:empty { display: none; }
.sale-customer-selected span { color: #7a8a7f; }
.sale-customer-results { display: grid; gap: 12px; margin: 0; }
.sale-customer-results:empty { display: none; }
.sale-customer-results p { margin: 0; }
.sale-customer-results .btn { text-align: left; justify-content: flex-start; white-space: normal; }
.sale-new-customer, .sale-new-product { display: grid; gap: 16px; padding: 16px; margin: 0; background: #f5f8f6; border-radius: 10px; }
.sale-new-customer > .btn { margin: 0; justify-self: start; }
.sale-item-list { display: grid; gap: 16px; margin: 0; }
.sale-item { display: grid; gap: 12px; padding: 16px; border: 1px solid #e0e5e2; border-radius: 10px; min-width: 0; }
/* 一行一件：商品与"移除"同一行，库存提示一行小字，三个数字一行 */
.sale-item-top { display: flex; align-items: center; gap: 8px; }
.sale-product-change { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; color: var(--app-text); text-align: left; font: inherit; cursor: pointer; }
.sale-product-change strong, .sale-product-change span { display: block; overflow-wrap: anywhere; }
.sale-product-change span { font-size: 14px; color: var(--app-text-secondary); margin-top: 4px; }
.sale-product-picker { min-width: 0; padding: 16px; margin: 0; border: 1px solid var(--app-line); border-radius: 10px; background: #f8faf8; }
.sale-product-tools { display: grid; gap: 16px; position: sticky; top: 0; z-index: 2; padding-bottom: 8px; background: #f8faf8; }
.sale-product-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
.sale-product-categories { display: flex; gap: 6px; min-width: 0; overflow-x: auto; }
.sale-product-categories:empty { display: none; }
.sale-product-categories button { flex: 0 0 auto; }
.sale-product-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.sale-product-results > .business-empty, .sale-product-results > .app-notice { grid-column: 1 / -1; }
.sale-product-result { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; min-width: 0; padding: 12px; border: 1px solid var(--app-line); border-radius: 10px; background: var(--app-white); text-align: left; font: inherit; cursor: pointer; }
.sale-product-result strong, .sale-product-spec { grid-column: 1; overflow-wrap: anywhere; }
.sale-product-result strong, .sale-product-price { grid-row: 1; }
.sale-product-spec, .sale-product-result > span:last-child { grid-row: 2; }
.sale-product-result > span:last-child, .sale-product-price { grid-column: 2; text-align: right; }
.sale-product-result strong { font-size: 15px; }
.sale-product-spec, .sale-product-price, .sale-product-stock { font-size: 14px; }
.sale-product-spec, .sale-product-stock { color: var(--app-text-secondary); }
.sale-product-price { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sale-product-result:disabled { cursor: default; }
.sale-product-result:not(:disabled):hover { border-color: var(--app-primary); }
.sale-product-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.sale-product-pager:empty { display: none; }
@media (max-width: 599px) { .sale-product-results { grid-template-columns: minmax(0, 1fr); } }
.sale-item-values { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.sale-item-field { display: grid; align-content: start; gap: 8px; min-width: 0; }
.sale-create-modal .sale-item-field > span { margin: 0; font-size: 15px; line-height: 1.5; }
.sale-stock { color: var(--app-text-secondary); font-size: 14px; }
/* 结论一行 + 参考一行：开单/换货的合计与退货窗的应退都长成这样，
   以前是一整串全角空格隔开的金额，手机上折行后谁也看不出哪个是要看的数。 */
.sale-totals, .ret-summary { display: grid; gap: 8px; margin: 0; padding-block: 12px; }
.sale-totals b, .ret-summary b { font-size: 20px; font-weight: 600; color: var(--app-text); }
.sale-totals span, .ret-summary span { font-size: 16px; color: var(--app-text-secondary); overflow-wrap: anywhere; }
.ret-summary .app-notice { margin-bottom: 0; font-size: 15px; color: #784c0c; }
p.sale-totals { margin: 14px 0 0; }
.sale-note-row { display: grid; gap: 10px; }
.sale-note-row > button { justify-self: start; }
/* 核对页：一件两行，金额对齐右边；五列表在手机上要么被切要么横滚，不划算 */
.sale-review-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.sale-review-title p { margin: 0; color: var(--app-text-secondary); font-size: 16px; }
.sale-review-items { display: grid; gap: 12px; margin: 0; }
.sale-review-item { padding: 16px; border: 1px solid var(--app-line); border-radius: 10px; background: #f8faf8; }
.sale-review-item__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sale-review-item__top strong { min-width: 0; font-size: 17px; overflow-wrap: anywhere; }
.sale-review-item__top span { flex-shrink: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.sale-review-item p { margin: 10px 0 0; color: var(--app-text-secondary); font-size: 16px; }
.sale-review-block { display: grid; gap: 12px; margin: 0; }
.sale-review-block h4 { margin: 0; font-size: 17px; }
.sale-review-note { margin: 0; font-size: 16px; color: var(--app-text-secondary); overflow-wrap: anywhere; }
/* 签字状态沿用共用徽标，重签仍是独立操作。 */
.sale-review-sign { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin: 0; }
/* 签字单独一屏：铺满、只留 返回／重签／确认签字 三个动作（背景不许滚，规则在 app.css 的弹窗锁里） */
.sign-stage { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.sign-stage::backdrop { background: #fff; }
.sign-stage:focus { outline: none; }
.sign-stage__head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; border-bottom: 1px solid var(--app-line); }
.sign-stage__who { flex: 1; min-width: 120px; margin: 0; font-size: 15px; font-weight: 500; color: var(--app-text); overflow-wrap: anywhere; }
.sale-signature-state { font-size: 14px; font-weight: 600; color: #52645a; }
.sign-stage__pad { position: relative; flex: 1; min-height: 0; background: #fff; }
.sign-stage__empty { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  color: #738279; font-size: clamp(22px, 4vw, 34px); letter-spacing: .12em; }
.sign-stage__empty[hidden] { display: none; }
.sale-item-error { margin: 0; color: var(--app-danger-text); font-size: 15px; }
.sale-item-error[hidden] { display: none; }
.sign-stage__foot { display: flex; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--app-line); }
.sign-stage__foot .btn { flex: 1; min-height: 48px; }
/* 白板就是中间那一整块：铺满、不画边框。
   以前是一条 3:1 的白框飘在灰屏里（手机竖屏只占可写区四成），四周空边看着就小气。
   纸面还是 600×200——笔迹在交出去之前按自己的包围盒等比放进去（见 signature.mjs）。 */
.sale-signature { position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  touch-action: none; user-select: none; -webkit-user-select: none; background: #fff; }
/* 竖屏整屏摆成横的（用户定的 A 方案）：宽高与位置都在 JS 里按视口算好，这里只负责转。
   刘海在竖屏的顶上，转完正好压在内容左边，所以头上与脚下都留一截安全距离。 */
.sign-stage--sideways { transform: rotate(90deg); }
.sign-stage--sideways .sign-stage__head { padding-top: 10px; padding-left: calc(14px + env(safe-area-inset-top, 0px)); }
.sign-stage--sideways .sign-stage__foot { padding-bottom: 12px; padding-left: calc(14px + env(safe-area-inset-top, 0px)); }
.sale-error { margin: 0 22px 16px; }
@media (max-width: 600px) {
  .sale-create-content { padding: 20px; }
  .sale-create-titlebar { gap: 8px 12px; }
  .sale-create-titlebar h2 { flex-basis: auto; }
  .sale-product-tools { position: static; padding-bottom: 0; }
  .sale-search .app-input { flex-basis: 100%; }
  .sale-item-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .sale-item-values > label:last-child { grid-column: 1 / -1; }
}
.keyboard-open .sale-product-tools { position: static; }

/* 退货窗：一行一件商品，左边是什么、右边填几件并勾"退不退回店里" */
.ret-lines { display: grid; gap: 16px; padding-top: 0; }
.ret-line { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--app-line); border-radius: 10px; background: #f8faf8; }
.ret-line__name { display: grid; gap: 6px; min-width: 0; }
.ret-line__name strong { font-size: 17px; }
.ret-line__name span { color: var(--app-text-secondary); font-size: 16px; overflow-wrap: anywhere; }
/* 件数在左、勾选在中、金额贴右：用 flex 让金额始终靠右，长标签换行也不会把金额挤到第三行 */
.ret-line__pick { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ret-line__pick .app-input { width: 88px; flex: 0 0 auto; }
.ret-stepper { display: inline-flex; align-items: center; gap: 4px; }
.ret-stepper .app-input { width: 64px; text-align: center; appearance: textfield; -moz-appearance: textfield; }
.ret-stepper .app-input::-webkit-inner-spin-button, .ret-stepper .app-input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.ret-step { width: 44px; height: 44px; border: 1px solid var(--app-line); border-radius: 8px;
  background: var(--app-white); color: var(--app-text); font: inherit; font-size: 22px; cursor: pointer; }
.ret-select-all { justify-self: end; }
.ret-line__back { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; color: var(--app-text-secondary); }
.ret-line__noproduct { font-size: 16px; font-weight: 500; color: #784c0c; }
.ret-line__pick b { margin-left: auto; font-size: 16px; white-space: nowrap; }
.ret-hint { margin: 0; color: var(--app-text-secondary); font-size: 16px; line-height: 1.6; }
.ret-history { padding-top: 10px; }
.ret-history summary { min-height: 44px; padding-block: 12px; font-size: 16px; cursor: pointer; }
@media (max-width: 600px) {
  .ret-line__pick .app-input { width: 76px; }
}
.sale-balance { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 12px; background: var(--app-surface-muted, #f3f7f4); border-radius: 8px; }
.sale-balance > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sale-balance-choice { flex: 1 1 100%; justify-content: space-between; }
.sale-balance-choice > strong { color: var(--app-primary-dark); }
.sale-balance-toggle { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; }
