.pisell-sku-detail-modal,
.pisell-sku-detail-drawer {

  // 让 Procedure 的 content 在 modal body 的高度内进行布局，子元素可使用 min-height:0 正常滚动
  .pisell-procedure-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }

  // Procedure 本体撑满 modal body 高度（否则内部 100% 高度链条断开）
  .pisell-sku-procedure,
  .pisell-procedure {
    height: 100%;
    min-height: 0;
  }

  // 右侧内容区作为 SKUOptionsSelection 的 scroll parent（真正发生滚动的容器）
  .sku-detail-right-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: 730px;
    /**
     * @description
     * 让滚动条不要贴着内容（尤其是 macOS overlay scrollbar 会覆盖内容）
     */
    box-sizing: border-box;
    padding-right: 12px;
    scrollbar-gutter: stable;
  }

  /**
   * @description 商品描述（可能为富文本 HTML）展示样式
   * - 约束图片/长文本不溢出容器
   * - 给常见块级元素提供合理间距
   */
  .sku-detail-right-content-detail-description {
    color: #344054;
    font-size: 14px;
    line-height: 20px;
    word-break: break-word;

    .sku-detail-right-content-detail-subtitle {
      margin-bottom: 8px;
    }

    .sku-detail-right-content-detail-description-html {
      p {
        margin: 0 0 8px 0;
      }

      ul,
      ol {
        margin: 0 0 8px 18px;
        padding: 0;
      }

      li {
        margin: 0 0 4px 0;
      }

      a {
        color: #7f56da;
        text-decoration: underline;
        text-underline-offset: 2px;
      }

      img {
        max-width: 100%;
        height: auto;
        display: block;
      }
    }
  }

  .pisell-sku-procedure {
    .pisell-procedure-content {
      padding-top: 0 !important;
      padding-bottom: 0;
      height: fit-content !important;
    }
    .pisell-batch-selector {
      padding-top: 0 !important;
    }
    .pisell-product-select__tabs-wrapper {
      padding-top: 0 !important;
    }
    .pisell-lowcode-layout {
      background: #fff!important;
    }
    .pisell-procedure-footer {
      border-top: 1px solid #e8e8e8 !important;
      background: #fff!important;
    }
    .pisell-procedure-sider-content-top{
      height: 100% !important;
    }
  }
  .pisell-lowcode-modal-body {
    border-radius: 16px;
    padding: 0!important;
    gap: 0!important;
  }
  .sku-detail-left-close {
    font-size: 20px;
    color: #7958d3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    margin-left: 100px;
  }

  /**
   * @description Header 左侧返回按钮（非第一步显示） + 第一页占位
   * 第一页必须渲染一个空 div 占位，避免 header 左右布局抖动
   */
  .sku-detail-left-back {
    font-size: 20px;
    color: #7958d3;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
    margin-right: 100px;
  }

  .sku-detail-left-back-placeholder {
    width: 66px;
    height: 24px;
    margin-right: 100px;
  }

  .product-image {
    width: 100%;
    height: 124px;
    flex-shrink: 0; // 关键：不让 flex 把它压小
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;

    img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      background: lightgray 50% / cover no-repeat;
    }

    .product-cover-text {
      width: 100%;
      height: 100%;
      background-color: #dedede;
      color: #747474;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 40px;
      font-weight: 600;
      line-height: 1;
      user-select: none;
    }
  }

  .product-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;

    .add-note-btn {
      width: 100%;
      height: 48px;
    }
  }

  .sku-detail-right {
    display: flex;
    flex-direction: column;
  }

  .product-info {
    display: flex;
    flex-direction: row;

    .product-info-left {
      display: flex;
      flex-direction: column;

      .product-name {
        color: #1B1B1B;
        font-size: 14px;
        font-weight: 600;
      }

      .product-spec {
        color: #344054;
        font-size: 14px;
        font-weight: 400;
      }
    }

    .item-price {
      color: #7f56da;
      font-size: 20px;
      font-weight: 600;
      text-align: right;
    }
  }

  .quantity-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;

    .quantity-section-title {
      color: #000;
      font-size: 14px;
      font-weight: 600;
    }

    span {
      color: #000;
      font-size: 14px;
      font-weight: 600;
    }
  }

  .note-section {
    margin-top: 8px;
    color: #7f56da;
    font-size: 14px;
    font-weight: 400;
    display: flex;
    align-items: baseline;
    gap: 6px;

    .note-label {
      flex-shrink: 0;
    }

    .note-text {
      width: fit-content;
      text-decoration: underline;
      text-underline-offset: 2px;
      cursor: pointer;
      word-break: break-word;
    }
  }

  .sku-detail-side-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 4px;
    margin-bottom: 16px;
  }

  .note-section-right {
    margin-top: 0;
    justify-content: flex-start;
    max-width: 100%;
  }

  .quantity-section-right {
    margin-bottom: 0;
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    .quantity-section-title {
      color: #344054;
      font-size: 14px;
      font-weight: 400;
      flex-shrink: 0;
    }
  }

  .selected-specification-section {

    .selected-specification-list,
    .selected-specification-group {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .selected-specification-group-children {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding-top: 4px;
    }

    .selected-specification-item {
      display: flex;
      align-items: flex-start;
      border-radius: 10px;
      background: #fff;
      border: 1px solid rgba(127, 86, 218, 0.08);
    }

    .selected-specification-item-main {
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      width: 100%;
    }

    .selected-specification-item-label {
      color: #344054;
      font-size: 16px;
      line-height: 20px;
      font-weight: 500;
      word-break: break-word;
    }

    .selected-specification-item-meta {
      flex-shrink: 0;
      color: #6941c6;
      font-size: 14px;
      line-height: 18px;
      font-weight: 600;
      white-space: nowrap;
    }

    .selected-specification-item-option,
    .selected-specification-item-variant,
    .selected-specification-item-bundle,
    .selected-specification-group-bundle {
      padding: 4px 5px;
    }

    .selected-specification-item-variant {
      background: linear-gradient(180deg, #ffffff 0%, #fcfaff 100%);
      border-color: rgba(127, 86, 218, 0.14);
    }

    .selected-specification-item-bundle .selected-specification-item-label {
      font-weight: 600;
    }

    .selected-specification-item-option .selected-specification-item-label {
      color: #475467;
    }

    .selected-specification-item-bundleOption .selected-specification-item-label {
      color: #475467;
      font-size: 15px;
    }

    .selected-specification-group-bundle {
      gap: 0;
      border-radius: 10px;
      background: #fff;
      border: 1px solid rgba(127, 86, 218, 0.16);

      .selected-specification-item {
        padding: 0;
        background: transparent;
        border: none;
        border-radius: 0;
      }

      .selected-specification-item-bundleOption {
        background: rgba(255, 255, 255, 0.72);
      }

      .selected-specification-group-children {
        border-top: 1px dashed rgba(127, 86, 218, 0.16);
        padding-left: 8px;
      }
    }
  }

  .price-summary-section {
    padding-top: 0;
    flex-shrink: 0;

    .price-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 4px;
      font-size: 14px;

      div {
        &:first-child {
          color: #344054;
          font-size: 14px;
          font-weight: 400;
        }

        &:last-child {
          color: #344054;
          font-size: 14px;
          font-weight: 600;
          white-space: nowrap;
        }
      }

      &-danger {
        color: #f04438 !important;
      }

      .price-item-override {
        color: #7f56da;
        font-size: 14px;
        font-weight: 400;
        cursor: pointer;
        // 兼容性更好的下划线解决方案
        text-decoration: none;
        border-bottom: 1px solid #7f56da;
        padding-bottom: 1px;
      }
    }

    .price-item-total {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 18px;
      font-weight: 600;
      color: #722ed1;
      padding-top: 4px;
      border-top: 1px solid rgba(0, 0, 0, 0.3);

      div {
        &:first-child {
          color: #344054;
          font-size: 16px;
          font-weight: 600;
        }

        &:last-child {
          color: #7f56da;
          font-size: 24px;
          font-weight: 600;
        }
      }

      .price-item-total-gst {
        color: #344054;
        font-size: 14px;
        font-weight: 400;
      }
    }

    .price-divider {
      height: 1px;
      background: #e8e8e8;
      margin: 12px 0;
    }
  }
  .sku-detail-content-footer-confirm-btn {
    width: 200px;
  }

  .sku-detail-content-footer {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;

    .sku-detail-content-footer-remove-btn {
      width: 120px;
    }

    .modal-actions {
      display: flex;
      gap: 8px;
      justify-content: flex-end;

      .sku-detail-content-footer-price-btn {
        width: 140px;

        .sku-detail-content-footer-price-btn-text {
          width: 100%;
          text-align: center;
          // 支持换行显示
          white-space: wrap;
          font-size: 16px;
          font-weight: 400;
          line-height: 20px;
        }
      }
    }
  }

  .sku-detail-side-actions {
    margin-top: 16px;
    flex-shrink: 0;

    .sku-detail-side-actions-list {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 8px;
    }

    .sku-detail-side-actions-btn {
      flex: 1 1 0;
      min-width: 120px;
      padding: 0 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      height: 44px;
    }

    .sku-detail-side-actions-primary {
      display: flex;
      gap: 8px;

      .sku-detail-side-actions-btn {
        min-width: 0;
      }
    }

    .sku-detail-side-actions-price-btn {
      .sku-detail-content-footer-price-btn-text {
        width: 100%;
        text-align: center;
        white-space: wrap;
        font-size: 16px;
        font-weight: 400;
        line-height: 20px;
      }
    }

    .sku-detail-side-actions-confirm-btn {
      min-width: 140px;
    }
  }

  &.aside-full {
    width: 55% !important;
    // 260423 如果没有sku aside 占满
    .pisell-sku-procedure {
      .pisell-procedure-content {
        display: none;
      }
      .pisell-procedure-sidebar {
        width: 100% !important;
        max-width: 100% !important;
      }
    }
  }

  .sku-detail-left {
    padding-left: 14px;
    /**
     * 让左侧内容成为垂直 flex 容器，便于把底部价格汇总“贴底”
     * 前提：父级侧边栏容器具备可用高度（PisellProcedure 内部通常已设置）
     */
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .sku-detail-left-top {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-right: 8px;
    gap: 12px;
  }

  .sku-detail-left-bottom {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    margin-top: 16px;
  }
}

.pisell-sku-detail-modal {
  /**
   * 固定弹窗高度，确保内部滚动容器有“可计算的最大高度”
   * 否则内容会把 modal 撑开，overflow-y: auto 无法生效（看起来就“滚不动”）
   */
  height: 884px;
  width: 80%!important;
  max-width: unset!important;

  // PisellModal（PC）内容容器：固定高度，内部 body 使用 flex 占满剩余空间
  .pisell-lowcode-modal-content {
    width: 100% !important;
    height: 884px;
    max-height: 884px!important;
    max-width: unset!important;
  }

  /**
   * @description 矮屏设备适配（例如 1366×763）
   * - 当屏幕高度本身低于 884px 时，整体弹窗高度下调，避免弹窗显示不全
   * - 同步调整右侧滚动容器最大高度，确保滚动区域可用
   */
  @media screen and (max-height: 883px) {
    height: 720px;

    .pisell-lowcode-modal-content {
      height: 720px;
      max-height: 720px !important;
    }

    .sku-detail-right-content {
      /**
       * @description
       * 同文件下方存在 `.sku-detail-right-content { max-height: 730px; }`
       * 且位置更靠后（同等优先级会覆盖本规则）。
       * 这里加 `!important` 确保矮屏媒体查询命中时右侧滚动容器高度能够正确收缩。
       */
      max-height: 566px !important;
    }
  }

  // SkuDetailModal 内部使用自定义滚动容器（右侧内容区），避免整块 modal body 滚动
  .pisell-lowcode-modal-body {
    width: 100% !important;
    overflow: hidden !important;
    min-height: 0;
  }
}

.pisell-sku-detail-drawer {
  .pisell-lowcode-drawer-body {
    padding: 0;
  }

  .pisell-lowcode-layout-content {
    padding: 0;
  }

  .pisell-procedure--modal .pisell-procedure-sidebar {
    width: 100% !important;
    height: unset !important;
  }

  .pisell-procedure-body {
    .pisell-lowcode-layout {
      gap: 0px !important;
    }
  }

  .pisell-procedure-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    padding: 12px 16px;

    .pisell-procedure-header__left {
      grid-column: 1;
      justify-self: start;
    }

    .pisell-procedure-header__center {
      grid-column: 2;
      justify-self: center;
      min-width: 0;
      padding: 0;
      text-align: center;
    }

    .pisell-procedure-header__right {
      grid-column: 3;
      justify-self: end;
    }

    .pisell-steps-mobile-current {
      justify-content: center;
    }

    .pisell-steps-mobile-current__info {
      align-items: center;
    }

    .pisell-steps-mobile-current__number,
    .pisell-steps-mobile-current__title {
      display: block;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  .sku-detail-left-close,
  .sku-detail-left-back,
  .sku-detail-left-back-placeholder {
    margin-left: 0;
    margin-right: 0;
  }

  .sku-detail-left-close,
  .sku-detail-left-back {
    white-space: nowrap;
  }

  .sku-detail-left {
    padding-left: 0;
  }

  .sku-detail-left-top {
    display: none;
  }

  .sku-detail-right-content {
    margin-right: -12px;
  }
}

// 价格调整覆盖层样式 - 现在通过 Portal 渲染到 document.body
.pisell-price-adjust-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999; // 由于现在渲染到 document.body，使用更高的 z-index
  display: flex;
  align-items: center;
  justify-content: center;
}

.pisell-price-adjust-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: transparent; // 纯透明遮罩
  cursor: pointer; // 显示点击手势
}

.pisell-price-adjust-container {
  position: relative;
  z-index: 10000; // 确保键盘在遮罩之上
}

.sku-detail-right-content-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #667085;

  p {
    margin: 0;
    text-align: center;
    font-size: 16px;
  }
}