/* 旧改设计 · 选择产品底部抽屉（内嵌选品页） */

.ps-drawer-layer {
  position: absolute;
  inset: 0;
  z-index: 48;
  pointer-events: none;
}

.ps-drawer-layer.is-open {
  pointer-events: auto;
}

.ps-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.ps-drawer-layer.is-open .ps-drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.ps-drawer-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: min(96%, 720px);
  max-height: 96%;
  background: #f1f5f9;
  border-radius: 16px 16px 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -16px 48px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  overflow: hidden;
}

.ps-drawer-layer.is-open .ps-drawer-sheet {
  transform: translateY(0);
}

.ps-drawer-sheet > .ps-viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 0;
  position: relative;
}

/* —— 顶栏：白底 + 下划线 Tab（项目 | 产品）—— */
.ps-drawer-sheet .ps-drawer-chrome {
  flex-shrink: 0;
  background: #fff;
  z-index: 3;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.ps-drawer-sheet .ps-drawer-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 8px auto 0;
}

.ps-drawer-sheet .ps-drawer-topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: end;
  gap: 4px;
  padding: 2px 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.ps-drawer-sheet .ps-drawer-close {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: start;
  width: 36px;
  height: 36px;
  margin-bottom: 6px;
  border: none;
  background: #f8fafc;
  border-radius: 10px;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.ps-drawer-sheet .ps-drawer-topbar-spacer {
  grid-column: 3;
  width: 44px;
  height: 1px;
}

/* 一级：文字 Tab，非胶囊 */
.ps-drawer-sheet .ps-scope-seg {
  grid-column: 2;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  max-width: 200px;
  margin: 0 auto 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
}

.ps-drawer-sheet .ps-scope-item {
  flex: 1;
  position: relative;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 16px;
  font-weight: 600;
  padding: 10px 16px 12px;
  border-radius: 0;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
}

.ps-drawer-sheet .ps-scope-item.active {
  color: #0f172a;
  background: transparent;
  box-shadow: none;
}

.ps-drawer-sheet .ps-scope-item.active::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.ps-drawer-sheet .ps-scope-item:not(.active):active {
  color: #64748b;
}

/* —— 二级：灰底工具条 + 紧凑胶囊 —— */
.ps-drawer-sheet .ps-drawer-subnav {
  background: #f1f5f9;
  padding: 10px 14px 12px;
  border-bottom: 1px solid #e2e8f0;
}

.ps-drawer-sheet .ps-drawer-subnav-label {
  margin: 0 2px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.ps-drawer-sheet .ps-segmented--drawer {
  margin: 0;
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  padding: 3px;
  background: #e2e8f0;
  border-radius: 10px;
  border: none;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ps-drawer-sheet .ps-segmented--drawer .ps-seg-item {
  font-size: 11px;
  font-weight: 600;
  padding: 8px 4px;
  min-height: 34px;
  border-radius: 8px;
  line-height: 1.2;
}

.ps-drawer-sheet .ps-segmented--drawer .ps-seg-item.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.ps-drawer-sheet.ps-scope-project .ps-drawer-subnav {
  display: none !important;
}

.ps-drawer-sheet.ps-scope-project .ps-scroll--drawer {
  display: none !important;
}

.ps-drawer-project-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px 24px;
  -webkit-overflow-scrolling: touch;
  background: #f1f5f9;
}

.ps-drawer-sheet.ps-scope-product .ps-drawer-project-panel {
  display: none !important;
}

.ps-project-intro {
  margin: 0 4px 12px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.ps-construction-phases {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ps-construction-empty {
  margin: 24px 8px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

.ps-phase-block {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e8edf3;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.ps-phase-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #fafbff 0%, #fff 100%);
  border-bottom: 1px solid #f1f5f9;
}

.ps-phase-index {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.ps-phase-title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.02em;
}

.ps-phase-add {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: #2563eb;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.ps-phase-add:active {
  transform: scale(0.96);
}

.ps-phase-items {
  list-style: none;
  margin: 0;
  padding: 6px 10px 10px;
}

.ps-phase-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 10px;
  transition: background 0.12s ease;
}

.ps-phase-item:not(.ps-phase-item--empty):active {
  background: #f8fafc;
}

.ps-phase-item--empty {
  justify-content: center;
  font-size: 12px;
  color: #cbd5e1;
  padding: 14px 8px;
}

.ps-phase-item-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  line-height: 1.35;
}

.ps-phase-item-del {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
}

.ps-phase-item-del:hover,
.ps-phase-item-del:focus-visible {
  background: #fef2f2;
  color: #ef4444;
}

.ps-add-construction-sheet {
  max-height: 78%;
  display: flex;
  flex-direction: column;
}

.ps-add-construction-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 160px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ps-construction-pick {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.ps-construction-pick:active:not(:disabled) {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.ps-construction-pick.is-disabled,
.ps-construction-pick:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: #f8fafc;
}

.ps-add-construction-custom-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}

.ps-add-construction-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 12px;
  background: #f8fafc;
}

.ps-add-construction-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.25);
  background: #fff;
}

.ps-add-construction-sheet .ps-sheet-primary {
  margin-bottom: 8px;
}

.ps-phase-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ps-phase-item-meta {
  font-size: 11px;
  font-weight: 600;
  color: #ea580c;
  font-variant-numeric: tabular-nums;
}

.ps-drawer-sheet .ps-phone-layer .ps-fullscreen.ps-construction-pick {
  background: #f1f5f9;
  color: #0f172a;
  z-index: 12;
}

.ps-construction-pick-body {
  flex: 1;
  min-height: 0;
}

.ps-construction-mock-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #eff6ff 0%, #e0e7ff 100%);
  position: relative;
}

.ps-construction-mock-icon {
  font-size: 26px;
  color: #2563eb;
  opacity: 0.85;
}

.ps-construction-mock-card.is-added {
  opacity: 0.72;
  pointer-events: auto;
}

.ps-construction-mock-card.is-added .ps-product-select-mark {
  display: none;
}

.ps-construction-added-badge {
  position: absolute;
  left: 4px;
  top: 4px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
}

#constructionPickConfirm {
  flex: 1;
  display: block;
}

#constructionPickConfirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ps-drawer-sheet .ps-scroll--drawer {
  flex: 1;
  min-height: 0;
  padding-top: 12px;
  background: linear-gradient(180deg, #eef4ff 0%, #f1f5f9 100px);
}

.ps-drawer-sheet .ps-scroll {
  flex: 1;
  min-height: 0;
}

.ps-drawer-sheet .ps-header .m-header-back {
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.ps-drawer-sheet .ps-phone-layer {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.ps-drawer-sheet .ps-phone-layer[aria-hidden="false"],
.ps-drawer-sheet .ps-phone-layer.is-active {
  pointer-events: auto;
}

/* 选品抽屉内 · 自定义上传产品（与 AI 结果页同款表单） */
.ps-drawer-sheet .ps-phone-layer:has(.ar-custom-product-sheet.show) {
  pointer-events: auto;
}

.ps-drawer-sheet .ps-phone-layer .ar-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 21;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.ps-drawer-sheet .ps-phone-layer .ar-sheet-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 22;
  max-height: 92%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  visibility: hidden;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet.show {
  transform: translateY(0);
  visibility: visible;
}

/* —— 自定义上传 · 视觉优化（选品抽屉内） —— */
.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished {
  max-height: 94%;
  background: #f8fafc;
  border-radius: 20px 20px 0 0;
  box-shadow:
    0 -1px 0 rgba(15, 23, 42, 0.06),
    0 -24px 64px rgba(15, 23, 42, 0.12);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-sheet-handle {
  width: 40px;
  height: 5px;
  margin-top: 10px;
  background: #cbd5e1;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-head {
  padding: 4px 16px 14px;
  border-bottom: none;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-sub {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.45;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.15s ease, transform 0.12s ease;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-close:active {
  transform: scale(0.96);
  background: #f1f5f9;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-body {
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-block {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8edf3;
  padding: 14px 14px 4px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-block .ar-custom-field {
  margin-bottom: 14px;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-block .ar-custom-field--last {
  margin-bottom: 10px;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-label {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap:not(.has-photos) {
  justify-content: stretch;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add {
  flex: 1;
  width: 100%;
  max-width: none;
  height: 104px;
  flex-direction: column;
  gap: 8px;
  border: 1.5px dashed #93c5fd;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
  color: #2563eb;
  font-size: 13px;
  font-weight: 600;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add-text {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap.has-photos .ar-custom-photo-add {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  flex-direction: row;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap.has-photos .ar-custom-photo-add-text {
  display: none;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap.has-photos .ar-custom-photo-add-icon {
  width: 100%;
  height: 100%;
  border: none;
  box-shadow: none;
  background: transparent;
  font-size: 20px;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add:active {
  transform: scale(0.98);
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-item {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag-row {
  gap: 8px;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag {
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag:active {
  transform: scale(0.97);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-select,
.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-input,
.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-textarea {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-select:focus,
.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-input:focus,
.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim-row {
  gap: 10px;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim-cap {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  letter-spacing: 0.04em;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-foot {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: none;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, #f8fafc 24%, #f8fafc 100%);
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-submit {
  min-height: 50px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-submit:active {
  transform: scale(0.98);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.26);
}

@media (prefers-reduced-motion: reduce) {
  .ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag,
  .ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-submit,
  .ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-close,
  .ps-drawer-sheet .ps-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add {
    transition: none;
  }
}
}