.diy-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  margin-bottom: 0;
  width: 100%;
  flex-wrap: wrap;
}

.diy-form-wrap {
  background: linear-gradient(180deg, #fffdf9, #fff7ed);
  border: 1px solid var(--lh-line, #ead9c3);
  border-radius: 20px;
  padding: 14px 18px 18px;
  margin: 0 auto;
  max-width: 1080px;
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: var(--lh-shadow-sm, 0 6px 18px rgba(66, 37, 14, 0.08));
  position: relative;
}

.diy-brand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 2px 14px;
  border-bottom: 2px solid #e6cdab;
  margin-bottom: 6px;
}

.diy-brand-head strong {
  display: block;
  font-size: 19px;
  font-weight: 900;
  color: var(--lh-brand-deep, #a8330f);
  margin-bottom: 4px;
}

.diy-brand-head span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #8b765d;
  letter-spacing: 1px;
}

.diy-brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--lh-brand, #d94a1e), var(--lh-ember, #f28b2f));
  color: #fff;
  font-size: 22px;
  box-shadow: 0 6px 16px rgba(168, 51, 15, 0.22);
}

.diy-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
  padding: 2px 4px;
  border-bottom: 1px solid #f3e6d4;
  min-height: 30px;
  position: relative;
  box-sizing: border-box;
}

.diy-row.header-row {
  padding-top: 6px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e6d2b8;
}

.diy-row .label {
  font-size: 13px;
  font-weight: 600;
  color: #533a26;
  text-align: right;
  padding-right: 2px;
  white-space: nowrap;
}

.diy-row .label.highlight {
  color: var(--lh-brand-deep, #a8330f);
  font-weight: 800;
}

.diy-row .label.danger {
  color: var(--lh-brand, #d94a1e);
  font-weight: 800;
}

.diy-row .header-cell {
  font-size: 12px;
  color: #8a5a30;
  font-weight: 700;
  text-align: center;
}

.diy-row input.diy-input {
  width: 100%;
  height: 28px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid #e3cbaa;
  border-radius: 10px;
  box-sizing: border-box;
  background: #fffdfa;
  color: var(--lh-brand-deep, #a8330f);
  text-align: center;
}

.diy-row input.diy-input:focus,
.ac-input:focus,
.diy-select:focus {
  border-color: var(--lh-brand, #d94a1e);
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 74, 30, 0.12);
}

.diy-row .total-input {
  font-weight: bold;
  color: var(--lh-brand-deep, #a8330f);
  background: #fff3e1 !important;
  font-size: 14px !important;
  text-align: center;
}

.diy-row .subtotal-input {
  color: #6f563e;
  background: #fbf4ea !important;
}

.readonly-input {
  background: #f5ecd9;
  color: #8b765d;
}

.diy-row-info {
  min-height: 30px !important;
  border-bottom: none;
}

.diy-row-info .info-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
}

.diy-row-info .info-label {
  font-size: 12px;
  color: #6f563e;
  text-align: right;
  white-space: nowrap;
  min-width: 62px;
  flex-shrink: 0;
  padding-right: 8px;
}

.uuid-input {
  width: 120px;
  height: 26px;
  padding: 2px 4px;
  font-size: 12px;
  letter-spacing: 1px;
  text-align: center;
  border: 1px solid #e3cbaa;
  border-radius: 8px;
  box-sizing: border-box;
  background: #fff3e1;
  color: var(--lh-brand-deep, #a8330f);
  font-weight: 700;
  flex-shrink: 0;
}

.diy-row-info .diy-select {
  flex: 1 1 auto;
  min-width: 0;
  height: 26px;
  padding: 2px 16px 2px 6px;
  font-size: 12px;
  text-align: left;
  border: 1px solid #e3cbaa;
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--lh-brand-deep, #a8330f);
  font-weight: 700;
  cursor: pointer;
}

.diy-select:disabled {
  background: #fbf4ea;
  color: var(--lh-brand-deep, #a8330f);
}

.ac-wrap {
  position: relative;
  width: 100%;
}

.ac-input {
  width: 100%;
  height: 26px;
  padding: 2px 8px;
  font-size: 13px;
  border: 1px solid #e3cbaa;
  border-radius: 10px;
  box-sizing: border-box;
  background: #fffdfa;
}

textarea.ac-input {
  height: auto;
  font-size: 15px;
  resize: none;
}

.ac-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  z-index: 50;
  background: #fffdf9;
  border: 1px solid #e3cbaa;
  border-top: none;
  border-radius: 0 0 12px 12px;
  max-height: 60vh;
  overflow-y: auto;
  box-shadow: var(--lh-shadow-sm, 0 6px 18px rgba(66, 37, 14, 0.08));
}

.ac-list.open {
  display: block;
}

.ac-item {
  padding: 8px 10px;
  font-size: 13px;
  color: #4b3929;
  cursor: pointer;
  border-bottom: 1px solid #f6ead9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  line-height: 1.3;
}

.ac-item.active,
.ac-item:hover {
  background: #fff1df;
  color: var(--lh-brand, #d94a1e);
}

.ac-item .ac-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-item .ac-price {
  color: var(--lh-brand-deep, #a8330f);
  font-weight: 800;
  flex-shrink: 0;
}

.ac-empty {
  padding: 8px 12px;
  font-size: 12px;
  color: #8b765d;
  text-align: center;
}

.diy-actions {
  text-align: center;
  margin: 20px 0 8px;
}

.diy-btn {
  background: linear-gradient(135deg, var(--lh-brand, #d94a1e), var(--lh-ember, #f28b2f));
  color: #fff;
  border: none;
  padding: 14px 38px;
  font-size: 15px;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(168, 51, 15, 0.24);
  font-weight: 800;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.diy-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 24px rgba(168, 51, 15, 0.3);
}

.diy-btn-clear {
  background: linear-gradient(135deg, #2f6d66, #4c9188);
  margin-left: 12px;
}

.diy-btn-recalc {
  background: linear-gradient(135deg, var(--lh-brand-deep, #a8330f), var(--lh-brand, #d94a1e));
  color: #fff;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  height: 52px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(168, 51, 15, 0.26);
}

.diy-total-wrap {
  grid-column: 2 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
}

.diy-row-total {
  min-height: 72px !important;
  background: linear-gradient(90deg, #fff3e1, #fffdf9);
  border-top: 2px solid #e6c99f;
  margin-top: 4px;
  border-radius: 0 0 14px 14px;
}

.diy-row-total .label {
  font-size: 17px !important;
  color: var(--lh-brand-deep, #a8330f) !important;
  white-space: nowrap;
}

/* 价格旁提醒：联系客服价格更优惠（做成小胶囊按钮，不抢主价） */
.diy-row-cta {
  min-height: auto !important;
  padding: 2px 0 8px;
}
.diy-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fdece0, #fff6ee);
  border: 1px solid #f0cfa8;
  color: var(--lh-brand-deep, #a8330f);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .3px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(168, 51, 15, .10);
  transition: transform .15s ease, box-shadow .15s ease;
}
.diy-cta:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(168, 51, 15, .16); }
.diy-cta:active { transform: translateY(0); }

/* 手机端：成品价与按钮缩放，避免顶破行 */
@media (max-width: 640px) {
  .diy-total-wrap { flex-wrap: wrap; row-gap: 8px; }
  .diy-row-total .total-input,
  .diy-row-total input.total-input { font-size: 28px !important; height: 46px !important; }
  .diy-cta { font-size: 12px; padding: 6px 12px; }
}

.diy-row-total .total-input,
.diy-row-total input.ac-input.total-input,
.diy-row-total input.total-input {
  font-size: 40px !important;
  height: 54px !important;
  font-weight: 900 !important;
  text-align: center !important;
  color: var(--lh-brand-deep, #a8330f) !important;
  background: transparent !important;
  border: none !important;
  letter-spacing: 0 !important;
  animation: totalPulse 2.4s ease-in-out infinite;
}

@keyframes totalPulse {
  0% { text-shadow: 0 0 2px rgba(217, 74, 30, 0.14); }
  50% { text-shadow: 0 0 12px rgba(217, 74, 30, 0.32); }
  100% { text-shadow: 0 0 2px rgba(217, 74, 30, 0.14); }
}

.diy-row-total .label {
  font-size: 17px;
  color: var(--lh-brand-deep, #a8330f);
}

.diy-fee-note {
  background: #fff8ed;
}

.diy-fee-note .fee-note {
  font-size: 11px;
  color: #8b765d;
  padding: 2px 4px;
  line-height: 1.3;
}

.diy-select {
  width: 100%;
  height: 28px;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid #e3cbaa;
  border-radius: 8px;
  background: #fffdfa;
  color: var(--lh-brand-deep, #a8330f);
  font-weight: 700;
}

.diy-row-info .diy-select {
  color: var(--lh-brand-deep, #a8330f);
}

textarea.ac-input {
  min-height: 34px;
}

#nicknameRow {
  grid-template-columns: 64px minmax(0, 1fr) auto;
}

.ai-btn-cell {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
}

.ai-btn-cell #aiRecommendBtn {
  flex: 0 0 auto;
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lh-brand, #d94a1e), var(--lh-ember, #f28b2f));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(168, 51, 15, 0.2);
}

.ai-btn-cell #aiRecommendBtn:disabled {
  background: #a38b70;
  cursor: not-allowed;
  box-shadow: none;
}

.ai-progress-backdrop {
  display: none;
  position: fixed;
  z-index: 10050;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: rgba(50, 28, 12, 0.2);
}

.ai-progress-backdrop.active {
  display: flex;
}

.ai-progress-modal {
  min-width: 260px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 20px 24px 18px;
  border: 1px solid #f4dcc0;
  border-radius: 18px;
  background: #fffdf9;
  box-shadow: var(--lh-shadow, 0 14px 40px rgba(66, 37, 14, 0.12));
  color: var(--lh-brand-deep, #a8330f);
  text-align: center;
}

.ai-progress-title {
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 800;
}

.ai-progress-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.ai-progress-spinner {
  width: 13px;
  height: 13px;
  border: 2px solid rgba(217, 74, 30, 0.2);
  border-top-color: var(--lh-brand, #d94a1e);
  border-right-color: var(--lh-ember, #f28b2f);
  border-radius: 50%;
  animation: aiProgressSpin 0.8s linear infinite;
}

@keyframes aiProgressSpin {
  to { transform: rotate(360deg); }
}

.diy-watermark {
  position: fixed;
  left: 0;
  right: 0;
  top: 180px;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.075;
  overflow: hidden;
}

.diy-watermark span {
  position: absolute;
  font-size: 14px;
  color: rgba(138, 58, 22, 0.6);
  font-weight: 800;
  letter-spacing: 1px;
  white-space: nowrap;
  transform: rotate(-20deg);
  user-select: none;
}

@media (max-width: 480px) {
  body > .container {
    width: auto;
    max-width: 100%;
    overflow: hidden;
  }
  .diy-row {
    padding: 1px 0;
    grid-template-columns: 54px minmax(0, 1fr) 62px;
    gap: 5px;
  }
  .diy-form-wrap {
    padding: 8px 8px 14px;
    border-radius: 16px;
  }
  .diy-row-total .total-input,
  .diy-row-total input.total-input {
    font-size: 32px !important;
  }
  .diy-btn {
    padding: 12px 24px;
  }
  .diy-btn-clear {
    margin-left: 6px;
  }
  .ai-btn-cell #aiRecommendBtn {
    padding: 6px 12px;
  }
}
/* ══════════════════════════════════════════════
   移动端 & 修复补丁（后置覆盖；全部保留 fallback，无需依赖 tokens 变量即可生效）
   修复 1: .diy-form-wrap{overflow:hidden} 裁掉自动补全下拉
   修复 2: 到手价窄屏降档被后置 !important 规则覆盖（本块后置，必胜）
   ══════════════════════════════════════════════ */
.diy-form-wrap { overflow: visible; }
.ac-wrap { min-width: 0; }
.ac-list {
  max-height: min(46vh, 300px);
  overscroll-behavior: contain;
  box-sizing: border-box;
  width: 100%;
  left: 0;
  right: 0;
  z-index: 60;
}

@media (max-width: 640px) {
  .diy-form-wrap { padding: var(--sp-2, 8px) var(--sp-2, 8px) var(--sp-4, 16px); }
  .diy-row { grid-template-columns: 56px minmax(0, 1fr) 68px; gap: 6px; }
  .diy-row .label { white-space: normal; line-height: 1.25; }
  .diy-row-total .total-input,
  .diy-row-total input.ac-input.total-input,
  .diy-row-total input.total-input { font-size: clamp(26px, 7vw, 34px) !important; height: 48px !important; }
  .diy-total-wrap { flex-wrap: wrap; row-gap: 8px; }
  .diy-btn-recalc { min-height: 44px; flex: 1 1 auto; }
  .ac-input, .diy-input, .uuid-input, .diy-select { min-height: 36px; }
  #aiRecommendBtn { min-height: 40px; }
  .diy-btn { min-height: 44px; }
  .diy-cta { min-height: 36px; }
}
@media (max-width: 400px) {
  .diy-row { grid-template-columns: 52px minmax(0, 1fr) 60px; }
}

/* ══════════════════════════════════════════════
   iPhone 16 Pro（402px）实测修复：
   1. 到手价输入框无显式宽度 → 被 size 属性撑到 418px 溢出屏幕
   2. 单号+配置类型行：select 被 uuid-input 挤成 28px
   ══════════════════════════════════════════════ */
.diy-row-total input.total-input,
.diy-row-total .total-input {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
@media (max-width: 640px) {
  .diy-row-info .info-inline { flex-wrap: wrap; row-gap: 6px; }
  .diy-row-info .info-label { min-width: auto; text-align: left; padding-right: 4px; }
  .diy-row-info .uuid-input { flex: 1 1 40%; width: auto; min-width: 96px; }
  .diy-row-info .diy-select { flex: 1 1 100%; width: 100%; min-width: 0; height: 34px; }
  .diy-row-total { min-height: auto !important; }
  .diy-row-total .label { font-size: 15px !important; }
  .diy-actions .diy-btn { padding: 10px 16px; font-size: 14px; }
}

/* ══ 手机端（保留完整页面 + 正常滚动） ══
   只做两件事：① 所有行统一三列网格（横平竖直）；② 防横向裁切（滑到任何位置截屏都完整）
   不隐藏任何区块、不强制一屏 ══ */
@media (max-width: 640px) {
  .page-diy .diy-row,
  .page-diy .diy-row.header-row,
  .page-diy .diy-row-info,
  .page-diy .diy-row-total,
  .page-diy .diy-row-cta,
  .page-diy .diy-fee-note {
    grid-template-columns: 56px minmax(0, 1fr) 72px !important;
    gap: 4px !important;
  }
  .page-diy .diy-row .label { white-space: nowrap; }
  .page-diy .ac-input, .page-diy .diy-input, .page-diy .uuid-input, .page-diy .diy-select,
  .page-diy textarea.ac-input { max-width: 100%; box-sizing: border-box; }
  .page-diy .diy-total-wrap { flex-wrap: wrap; }
  .page-diy .diy-row-total .total-input { flex: 1 1 100%; min-width: 0; width: 100%; }
}

/* ══ 融合版：完整页面 + 正常滚动；表单区压缩到「一屏可截」 ══
   外壳（促销/报价条/导航/页脚）全部保留；只压缩 DIY 表单自身 ══ */
@media (max-width: 640px) {
  .page-diy .diy-form-wrap { padding: 4px 8px 8px !important; border-radius: 10px !important; }
  .page-diy .diy-brand-head { padding: 2px 4px 4px !important; min-height: 0 !important; }
  .page-diy .diy-brand-head strong { font-size: 14px !important; }

  .page-diy .diy-row,
  .page-diy .diy-row.header-row,
  .page-diy .diy-row-info,
  .page-diy .diy-row-total,
  .page-diy .diy-row-cta,
  .page-diy .diy-fee-note {
    min-height: 28px !important;
    padding: 1px 0 !important;
  }
  .page-diy .ac-input, .page-diy .diy-input, .page-diy .uuid-input, .page-diy .diy-select,
  .page-diy textarea.ac-input {
    height: 26px !important; min-height: 26px !important;
    font-size: 12px !important; padding: 1px 6px !important; border-radius: 7px !important;
  }
  .page-diy .diy-row .label { font-size: 12px !important; line-height: 1.1; }
  .page-diy .header-cell { font-size: 11px !important; }
  .page-diy .diy-row-info .info-label { min-width: auto !important; padding-right: 2px !important; font-size: 11px !important; }
  .page-diy .diy-row-info .uuid-input { width: 78px !important; }
  .page-diy .diy-row-info .diy-select { flex: 1 1 auto !important; height: 26px !important; }
  .page-diy .diy-row-total { min-height: 34px !important; }
  .page-diy .diy-row-total .total-input { font-size: 20px !important; height: 28px !important; }
  .page-diy .diy-btn-recalc { min-height: 24px !important; padding: 2px 8px !important; font-size: 11px !important; }
  .page-diy .diy-fee-note { min-height: 16px !important; }
  .page-diy .diy-fee-note .fee-note { font-size: 10px !important; line-height: 1.2; }
  .page-diy .diy-cta { min-height: 22px !important; font-size: 11px !important; padding: 1px 10px !important; }
  .page-diy .diy-actions { margin-top: 2px !important; min-height: 34px !important; }
  .page-diy .diy-actions .diy-btn { min-height: 32px !important; padding: 5px 12px !important; font-size: 13px !important; }
  .page-diy #aiRecommendBtn { min-height: 26px !important; padding: 2px 8px !important; font-size: 11px !important; }
}

/* 融合版二刀：单号+配置类型收成单行；行高再减 2px（表单目标 ≤800px） */
@media (max-width: 640px) {
  .page-diy .diy-row-info .info-inline { flex-wrap: nowrap !important; gap: 3px !important; }
  .page-diy .diy-row-info .uuid-input { width: 72px !important; }
  .page-diy .diy-row-info .info-label { min-width: auto !important; font-size: 11px !important; padding-right: 1px !important; }
  .page-diy .diy-row-info .diy-select { flex: 1 1 auto !important; min-width: 0 !important; height: 26px !important; }
  .page-diy .diy-row,
  .page-diy .diy-row.header-row,
  .page-diy .diy-row-info,
  .page-diy .diy-row-cta,
  .page-diy .diy-fee-note { min-height: 27px !important; }
  .page-diy textarea.ac-input { height: 27px !important; min-height: 27px !important; }
}
