/* 用户端广告始终固定在顶部；正文按广告实际高度自动下移，避免遮挡最近订单。 */
.ad-sticky-top {
  position: fixed !important;
  top: 0 !important;
  right: 0 !important;
  left: 0 !important;
  z-index: 20 !important;
}

/* 商户订单主列表：手机端按订单卡片展示，不横向挤压客户信息。 */
.order-status-cell small {
  display: block;
  margin-top: 6px;
  color: #475569;
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
}

@media (max-width: 680px) {
  .orders-table,
  .orders-table tbody {
    display: block;
    width: 100%;
  }

  .orders-table > thead {
    display: none;
  }

  .orders-table .order-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0;
    margin: 12px 0;
    border: 2px solid #cbd5e1;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
  }

  .orders-table .order-row > td {
    display: block;
    width: auto;
    min-width: 0;
    padding: 12px;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .orders-table .order-row > .order-status-cell {
    border-right: 1px solid #e2e8f0;
  }

  .orders-table .order-row > .customer-cell {
    grid-column: 1 / -1;
    background: #f8fafc;
  }

  .orders-table .order-row > .order-total-cell {
    display: flex;
    align-items: center;
    color: #991b1b;
    font-size: 18px;
    font-weight: 800;
  }

  .orders-table .order-row > td:last-child {
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .orders-table .order-detail-row,
  .orders-table .order-detail-row > td {
    display: block;
    width: 100%;
  }
}

/* 底部下单栏按真实高度为页面预留空间，兼容全面屏安全区域。 */
.merchant-page {
  padding-top: calc(var(--customer-ad-height, 0px) + 8px) !important;
  padding-bottom: calc(168px + env(safe-area-inset-bottom, 0px)) !important;
}

/* 用户端仅对大于 0 的下单数量使用红色字体。 */
.merchant-page .qty-input.qty-input-active {
  color: #dc2626 !important;
  -webkit-text-fill-color: #dc2626;
}

.submit-bar {
  box-sizing: border-box;
  max-width: 100vw;
}

.overdue-order {
  background: #fff7ed !important;
}

.overdue-pick {
  border: 1px solid #fb923c;
  background: #ffedd5;
  color: #c2410c;
}

/* 商户端重要操作的统一文字反馈；声音和震动由操作成功后触发。 */
.vendor-action-feedback {
  position: fixed;
  top: max(18px, env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 9999;
  width: min(88vw, 420px);
  padding: 14px 18px;
  transform: translateX(-50%);
  border-radius: 12px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.24);
}

.vendor-action-feedback.success { background: #15803d; }
.vendor-action-feedback.error { background: #b91c1c; }

.order-status-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.order-subnav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.order-subnav button {
  min-height: 48px;
  padding: 9px;
  border: 2px solid #64748b;
  border-radius: 10px;
  background: #fff;
  color: #1e293b;
  font-size: 16px;
  font-weight: 800;
}

.order-subnav button.active {
  border-color: #166534;
  background: #166534;
  color: #fff;
}

.order-status-filter button {
  min-height: 46px;
  padding: 8px 6px;
  border: 2px solid #94a3b8;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 15px;
  font-weight: 700;
}

.order-status-filter button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.order-print-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
}

.order-print-filters label {
  display: grid;
  gap: 5px;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.order-print-filters select,
.order-print-filters input {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 14px;
}

.order-date-range {
  display: grid;
  grid-column: span 2;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 640px) {
  .order-status-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-print-filters {
    grid-template-columns: 1fr;
  }

  .order-date-range {
    grid-column: auto;
    grid-template-columns: 1fr;
  }
}

.platform-catalog-manager .catalog-upload-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.platform-catalog-manager .catalog-preview-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #86efac;
  border-radius: 12px;
  background: #f0fdf4;
}

.catalog-preview-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.catalog-preview-metrics span {
  padding: 9px;
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.catalog-history {
  margin-top: 16px;
}

.catalog-scope-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.order-history-button {
  width: 100%;
  margin: 0 0 10px;
  min-height: 48px;
  font-size: 17px;
  font-weight: 700;
}

.order-history-dialog {
  width: min(680px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}

.order-history-modal {
  z-index: 100 !important;
}

.order-history-header,
.order-history-summary,
.order-history-items > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.order-history-header h2 {
  margin: 0;
}

.order-history-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.order-history-card {
  padding: 13px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
}

.order-history-items {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.order-history-total {
  display: block;
  margin-top: 8px;
  text-align: right;
}

/* 给价格管理表添加独立标识后，在手机上转为纵向卡片，避免七列被挤窄。 */
@media (max-width: 640px) {
  .product-admin-table,
  .product-admin-table tbody,
  .product-admin-table tr,
  .product-admin-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .product-admin-table thead {
    display: none;
  }

  .product-admin-table tr {
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
  }

  .product-admin-table td {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 6px 0 !important;
    border: 0 !important;
  }

  .product-admin-table td::before {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
  }

  .product-admin-table td:nth-child(1)::before { content: "行业大类"; }
  .product-admin-table td:nth-child(2)::before { content: "行业小类"; }
  .product-admin-table td:nth-child(3)::before { content: "产品名称"; }
  .product-admin-table td:nth-child(4)::before { content: "单位/定价"; }
  .product-admin-table td:nth-child(5)::before { content: "常用"; }
  .product-admin-table td:nth-child(6)::before { content: "状态"; }
  .product-admin-table td:nth-child(7)::before { content: "操作"; }

  .product-admin-table select,
  .product-admin-table input[type="number"] {
    min-height: 40px;
    max-width: 100%;
  }

  .share-link-row,
  .merchant-register-row {
    overflow: hidden;
  }

  .share-link-text {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

/* 商户链接折叠区。 */
.share-collapse-toggle {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #fff;
  color: #1e40af;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.share-search-input {
  width: 100%;
  min-height: 44px;
  margin: 10px 0;
  padding: 8px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 15px;
  box-sizing: border-box;
}

.picking-management-embedded {
  padding: 0 !important;
  overflow: hidden;
}

.picking-management-frame {
  display: block;
  width: 100%;
  min-height: 620px;
  border: 0;
  background: #f1f5f9;
}

@media (max-width: 680px) {
  .picking-management-frame {
    min-height: 720px;
  }
}

/* 跨凌晨经营设置：手机上清楚说明“次日截止”的含义。 */
.overnight-cutoff-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
}

.overnight-cutoff-option input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  margin: 2px 0 0;
}

.overnight-cutoff-option span { display: grid; gap: 4px; }
.overnight-cutoff-option strong { color: #1e3a8a; font-size: 16px; }
.overnight-cutoff-option small { color: #475569; line-height: 1.45; }

/* 订单展开后的商品详情：桌面保证表头对比度，手机改为纵向商品卡片。 */
.order-detail .detail-items-table th {
  background: #0f172a !important;
  color: #fff !important;
  opacity: 1 !important;
}

.order-detail .detail-items-table td {
  color: #0f172a;
  background: #fff;
}

@media (max-width: 680px) {
  .order-detail { padding: 12px 8px; }
  .order-detail .detail-section { min-width: 0; }
  .order-detail .detail-items-table,
  .order-detail .detail-items-table tbody,
  .order-detail .detail-items-table tfoot {
    display: block;
    width: 100%;
  }

  .order-detail .detail-items-table thead { display: none; }

  .order-detail .detail-items-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    margin: 0 0 12px;
    padding: 14px;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
  }

  .order-detail .detail-items-table tbody td {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .order-detail .detail-items-table tbody td::before {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
  }

  .order-detail .detail-items-table tbody td:nth-child(1) {
    grid-column: 1 / -1;
    color: #0f172a;
    font-size: 19px;
    font-weight: 800;
  }
  .order-detail .detail-items-table tbody td:nth-child(1)::before { content: "产品"; }
  .order-detail .detail-items-table tbody td:nth-child(2)::before { content: "单位"; }
  .order-detail .detail-items-table tbody td:nth-child(3)::before { content: "下单数量"; }
  .order-detail .detail-items-table tbody td:nth-child(4) {
    grid-column: 1 / -1;
  }
  .order-detail .detail-items-table tbody td:nth-child(4)::before { content: "实际分拣数量"; }
  .order-detail .detail-items-table tbody td:nth-child(5)::before { content: "单价"; }
  .order-detail .detail-items-table tbody td:nth-child(6)::before { content: "小计"; }

  .order-detail .actual-qty-input {
    width: 100% !important;
    min-height: 58px;
    padding: 10px 14px;
    border: 3px solid #2563eb;
    border-radius: 10px;
    color: #b91c1c;
    font-size: 24px;
    font-weight: 800;
    text-align: center;
  }

  .order-detail .detail-items-table tfoot tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    padding: 12px 4px;
    border-top: 2px solid #0f172a;
  }
  .order-detail .detail-items-table tfoot td {
    display: block;
    padding: 4px !important;
    border: 0 !important;
    color: #991b1b;
    font-size: 18px;
    font-weight: 800;
  }
}

.order-quantity-summary { display:block; margin-top:8px; padding:6px 8px; border-radius:6px; background:#eff6ff; color:#1d4ed8; font-size:14px; font-weight:800; line-height:1.35; }
.picking-revision-box { width:100%; }
.picking-revision-list { margin-top:8px; padding:8px 10px; border-radius:8px; background:#f8fafc; }
.picking-revision-list p { margin:0; padding:8px 0; border-bottom:1px solid #e2e8f0; font-size:14px; line-height:1.5; }
.picking-revision-list p:last-child { border-bottom:0; }
.actual-qty-input:disabled { background:#f1f5f9; color:#0f172a; opacity:1; }

/* 平台广告管理：不同尺寸的上传图片只在统一预览框内缩放，避免竖图撑高整行卡片。 */
#platform-ads .data-grid {
  align-items: start;
}

#platform-ads .data-grid > .admin-card {
  align-self: start;
  overflow: hidden;
}

#platform-ads .data-grid > .admin-card > img:first-child {
  display: block;
  width: 100%;
  height: 180px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  object-fit: contain;
}

#platform-ads .data-grid > .admin-card > div:first-child:not(.row-actions) {
  height: 180px;
  min-height: 180px;
  overflow: hidden;
}

@media (max-width: 640px) {
  #platform-ads .data-grid > .admin-card > img:first-child,
  #platform-ads .data-grid > .admin-card > div:first-child:not(.row-actions) {
    height: 150px;
    min-height: 150px;
  }
}

/* clickable-phone */
.phone-link{color:#087e9b;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;font-weight:700;display:inline-flex;align-items:center;min-height:32px;padding:2px 4px;border-radius:6px;touch-action:manipulation}.phone-link:active{background:#dff6fb;color:#075f73}

/* prominent-order-number */
.order-number-badge,.order-number-detail,.customer-order-number{display:inline-flex;align-items:center;width:max-content;max-width:100%;padding:6px 11px;border:2px solid #1d4ed8;border-radius:9px;background:#dbeafe;color:#1e3a8a;font-size:18px;font-weight:900;line-height:1.1;letter-spacing:.5px}.order-status-cell .order-number-badge{display:flex;margin-bottom:8px}.order-number-detail{margin-bottom:10px;font-size:21px}.customer-order-number{margin-right:8px;font-size:16px}

/* dynamic-customer-invitations */
.invitation-generate-button{width:100%;min-height:54px;font-size:18px}.invitation-message{padding:10px 12px;border-radius:8px;background:#ecfdf5;color:#166534;font-weight:700}.invitation-new-link{margin-top:2px}.invitation-history{border:1px solid #bfdbfe;border-radius:10px;background:#fff;overflow:hidden}.invitation-history summary{padding:12px 14px;color:#1e40af;font-weight:800;cursor:pointer}.invitation-list{display:grid;gap:8px;padding:0 12px 12px}.invitation-record{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px;border-radius:8px;background:#f8fafc;border:1px solid #e2e8f0}.invitation-record>div{display:flex;align-items:center;flex-wrap:wrap;gap:6px 14px;min-width:0}.invitation-record span{color:#475569;font-size:14px}.invitation-record button{min-height:38px;padding:6px 12px}@media(max-width:640px){.invitation-record{align-items:stretch;flex-direction:column}.invitation-record button{width:100%}.invitation-new-link{grid-template-columns:1fr auto}.invitation-new-link .share-shop-name{grid-column:1/-1}.invitation-new-link .share-link-text{min-width:0}}

/* customer-panel-cleanup */
.customer-invite-panel{display:grid;gap:12px;padding:18px;border:1px solid #d9e5df!important;border-radius:18px!important;background:linear-gradient(145deg,#fff 0%,#f6fbf8 100%)!important;box-shadow:0 8px 24px rgba(15,58,40,.08)}
.customer-invite-heading{display:flex;align-items:center;gap:12px}.customer-invite-heading h3{margin:0;color:#123f2b;font-size:22px}.customer-invite-heading .share-hint{margin:3px 0 0;color:#64748b;line-height:1.45}.customer-invite-icon{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border-radius:14px;background:#e4f4ea;color:#146b3a;font-size:26px;font-weight:900}
.customer-invite-panel .invitation-generate-button{border-radius:12px;box-shadow:0 6px 14px rgba(20,107,58,.18)}.customer-invite-panel .customer-list-toggle,.customer-invite-panel .inactive-customer-toggle{margin:0;border:1px solid #d9e5df;border-radius:12px;background:#fff;color:#173f30;box-shadow:none}.customer-invite-panel .customer-list-toggle{margin-top:2px}
.customer-share-links{gap:10px}.customer-link-card{grid-template-columns:minmax(150px,.8fr) minmax(180px,1.6fr) auto;align-items:center;padding:12px;border:1px solid #e2e8f0;border-radius:12px;background:#fff}.customer-link-title{display:grid;gap:3px}.customer-link-title strong{color:#17233b;font-size:17px}.customer-link-title small,.inactive-customer-row small{color:#64748b}.customer-link-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px}.customer-stop-button{min-height:40px;padding:8px 13px}.inactive-customer-section{display:grid;gap:8px}.inactive-customer-list{display:grid;gap:8px}.inactive-customer-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:11px 12px;border-radius:10px;background:#f8fafc;border:1px solid #e2e8f0}.inactive-customer-row>div{display:grid;gap:3px}
.orders-table .customer-cell .shop-name-primary{display:block;color:#10233f;font-size:18px;line-height:1.35;margin-bottom:3px}.orders-table .customer-cell .cust-name-secondary{font-size:14px;color:#64748b;font-weight:600}
@media(max-width:640px){.customer-invite-panel{padding:15px 13px;border-radius:15px!important}.customer-invite-heading h3{font-size:20px}.customer-invite-icon{width:40px;height:40px;flex-basis:40px}.customer-link-card{display:grid!important;grid-template-columns:1fr!important;gap:9px}.customer-link-actions{display:grid;grid-template-columns:1fr auto 1fr}.customer-link-actions .copy-btn,.customer-link-actions .customer-stop-button{width:100%;min-height:44px}.inactive-customer-row{align-items:stretch;flex-direction:column}.inactive-customer-row button{width:100%;min-height:44px}.orders-table .customer-cell .shop-name-primary{font-size:19px}}


/* compact-order-cards-and-accessible-quantity-controls */
/* 商户订单卡片：仅压缩手机端主列表，不影响展开明细和打印。 */
@media (max-width: 680px) {
  .orders-table .order-row {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
    margin: 9px 0;
  }

  .orders-table .order-row > td {
    padding: 9px 10px;
  }

  .orders-table .order-row > .customer-cell {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr);
    align-items: center;
    gap: 3px 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .orders-table .customer-cell .shop-name-primary,
  .orders-table .customer-cell .cust-name {
    grid-column: 1;
    font-size: 17px;
  }

  .orders-table .customer-cell .cust-phone {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    font-size: 15px;
  }

  .orders-table .customer-cell .cust-addr,
  .orders-table .customer-cell .order-quantity-summary {
    grid-column: 1 / -1;
  }

  .orders-table .customer-cell .order-quantity-summary {
    margin-top: 3px;
  }

  .orders-table .order-status-cell small {
    margin-top: 3px;
    font-size: 12px;
  }
}

/* 用户下单：字号只小幅增加，重点放大加减按钮的触控面积。 */
@media (max-width: 680px) {
  .merchant-page .product-name-col strong {
    font-size: 17px;
  }

  .merchant-page .qty-stepper-btn {
    width: 34px;
    min-width: 34px;
    min-height: 50px;
    padding: 0;
    font-size: 23px;
    touch-action: manipulation;
  }

  .merchant-page .qty-stepper .qty-input {
    width: 58px;
    min-height: 50px;
    padding: 6px 3px;
    font-size: 21px;
  }

  .merchant-page .unit-select,
  .merchant-page .unit-fixed {
    min-height: 50px;
    font-size: 18px;
  }
}
