@sale-detail-prefix: pisell-sale-detail;

.@{sale-detail-prefix}-tmpl-b {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #181818;

  .@{sale-detail-prefix}-tmpl-overview {
    flex: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .@{sale-detail-prefix}-tmpl-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background-color: #0a0a10;
  }

  .@{sale-detail-prefix}-tmpl-workspace {
    display: flex;
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .@{sale-detail-prefix}-tmpl-sider {
    display: flex;
    align-items: stretch;
    flex: none;
    flex-direction: column;
    gap: 4px;
    width: 78px;
    min-height: 0;
    overflow: auto;
    padding: 8px 4px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: #070d1a;
    scrollbar-width: none;
    -ms-overflow-style: none;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  .@{sale-detail-prefix}-tmpl-sider-tab {
    position: relative;
    display: flex;
    flex: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 54px;
    padding: 6px 2px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.76);
    font-size: 13px;
    text-align: center;
    background: transparent;
    cursor: pointer;

    &--active {
      color: #fff;
      background: rgba(127, 86, 217, 0.18);
    }

    &__icon {
      flex: none;
      font-size: 20px;
      line-height: 1;
    }

    &__label {
      display: block;
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    &__badge {
      position: absolute;
      top: -4px;
      right: -2px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 18px;
      height: 18px;
      padding: 0 5px;
      border: 1px solid #070d1a;
      border-radius: 999px;
      color: #fff;
      font-size: 12px;
      font-weight: 800;
      line-height: 16px;
      background: #f04438;
      box-shadow: 0 4px 10px rgba(240, 68, 56, 0.35);
      box-sizing: border-box;
    }
  }

  .@{sale-detail-prefix}-tmpl-right {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  .@{sale-detail-prefix}-tmpl-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .@{sale-detail-prefix}-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    overflow: hidden;
    padding: 6px 8px;
  }

  .@{sale-detail-prefix}-footer {
    flex: none;
    overflow: hidden;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #05070d;
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.36);
  }

  .@{sale-detail-prefix}-button-actions {
    flex: none;
    padding: 8px 10px;
    background: #05070d;

    .pisell-lowcode-flex {
      gap: 8px;
      margin-bottom: 0 !important;
    }

    .pisell-lowcode-space {
      display: flex;
      width: 100%;
    }

    .pisell-lowcode-space-item {
      flex: 1;
      min-width: 0;

      > .pisell-lowcode-btn {
        width: 100%;
        height: 48px;
        border-radius: 8px;
      }
    }

    &--template-b {
      padding: 8px;

      .pisell-lowcode-flex {
        gap: 10px;
      }

      .pisell-lowcode-space {
        gap: 10px !important;
      }

      .pisell-lowcode-space-item {
        flex: 1 1 0;

        .pisell-lowcode-btn {
          width: 100%;
          padding: 0 16px;
          border-width: 1.5px;
          border-radius: 10px;
        }
      }

      .@{sale-detail-prefix}-button-actions__button {
        gap: 12px;
        color: #f7f2ff;
        border-color: #5a28bf;
        background: #1b0b3a;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
        font-size: 14px;
        font-weight: 800;
        line-height: 16px;

        &:not(:disabled):hover,
        &:not(:disabled):active {
          color: #fff;
          border-color: #7a4df5;
          background: #241052;
        }

        .pisell-lowcode-btn-icon {
          margin-inline-end: 0;
          color: #c4b5fd;
        }

        > span:not(.pisell-lowcode-btn-icon) {
          display: -webkit-box;
          flex: 0 1 auto;
          max-height: 40px;
          overflow: hidden;
          text-align: center;
          text-overflow: ellipsis;
          white-space: normal;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          line-clamp: 2;
        }

        &--primary,
        &--checkout {
          color: #f5fff9;
          border-color: #16825e;
          background: #062c20;

          &:not(:disabled):hover,
          &:not(:disabled):active {
            color: #fff;
            border-color: #23a979;
            background: #073c2a;
          }

          .pisell-lowcode-btn-icon {
            color: #6ee7a8;
          }
        }

        &--refund,
        &--cancel {
          color: #fde2e4;
          border-color: #79303a;
          background: #2b0912;

          &:not(:disabled):hover,
          &:not(:disabled):active {
            color: #fff;
            border-color: #a54551;
            background: #3a0d19;
          }

          .pisell-lowcode-btn-icon {
            color: #f4a0a8;
          }
        }

        &:disabled {
          color: rgba(255, 255, 255, 0.45);
          cursor: not-allowed;
          border-color: rgba(255, 255, 255, 0.12);
          background: #24212d;

          .pisell-lowcode-btn-icon {
            color: rgba(255, 255, 255, 0.35);
          }

          &:hover {
            color: rgba(255, 255, 255, 0.45);
            border-color: rgba(255, 255, 255, 0.12);
            background: #24212d;
          }
        }
      }

      .@{sale-detail-prefix}-button-actions__button
        > .@{sale-detail-prefix}-button-actions__checkout-content {
        flex: 1 1 auto;
        align-items: center;
        text-align: center;
      }

      .@{sale-detail-prefix}-button-actions__checkout-title {
        color: inherit;
        font-size: inherit;
        font-weight: inherit;
      }

      .@{sale-detail-prefix}-button-actions__checkout-amount {
        display: block;
        width: 100%;
          font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
      }
    }

    &__button {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 48px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 700;
      line-height: 16px;
      white-space: normal;
      word-break: normal;
      overflow-wrap: normal;

      .pisell-lowcode-btn-icon {
        display: inline-flex;
        flex: none;
        align-items: center;
        font-size: 18px;

        svg {
          width: 18px;
          height: 18px;
        }
      }

      > span:not(.pisell-lowcode-btn-icon) {
        display: -webkit-box;
        flex: 0 1 auto;
        min-width: 0;
        max-height: 32px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: normal;
        overflow-wrap: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
      }

      &--return > .@{sale-detail-prefix}-button-actions__return-label {
        display: -webkit-box;
        max-width: calc(100% - 26px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
      }

      &--primary {
        color: #fff;
        border-color: #7f56d9;
        background: #7f56da;

        &:not(:disabled):hover,
        &:not(:disabled):active {
          color: #fff;
          border-color: #6941c6;
          background: #6941c6;
        }
      }

      &--edit {
        color: #2563eb;
        border-color: #2563eb;

        &:not(:disabled):hover,
        &:not(:disabled):active {
          color: #2563eb;
          border-color: #2563eb;
        }
      }

      &:disabled {
        color: #fff;
        cursor: not-allowed;
        background: #bfbfbf;
        border-color: #bfbfbf;

        &:hover {
          color: #fff;
          background: #bfbfbf;
          border-color: #bfbfbf;
        }
      }
    }

    &__button > &__checkout-content {
      display: inline-flex;
      flex: 1 1 auto;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      max-height: none;
      overflow: visible;
      line-height: 16px;
      text-align: center;
      white-space: normal;
    }

    &__checkout-title {
      display: block;
      width: 100%;
      white-space: nowrap;
    }

    &__checkout-amount {
      display: block;
      width: 100%;
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
    }
  }

  // ===== summaryTwoColumn：summary tab 两栏布局（金额明细 + footer 抽到右列）=====
  // container-type 只挂在 --two-col 上，故仅本场景生效，不影响其他模板 B 用法。
  .@{sale-detail-prefix}-tmpl-right--two-col {
    container-type: inline-size;
  }

  .@{sale-detail-prefix}-tmpl-pair {
    display: flex;
    flex: 1;
    flex-direction: column; // 窄：上下堆叠
    min-width: 0;
    min-height: 0;
    overflow: hidden;

    > .@{sale-detail-prefix}-tmpl-main {
      flex: 1;
      min-width: 0;
      min-height: 0;
    }
  }

  // 右列：金额明细 + 底部金额汇总/操作按钮
  .@{sale-detail-prefix}-tmpl-money {
    display: flex;
    flex: none;
    flex-direction: column;
    min-width: 0;
    max-height: 48%; // 窄屏堆叠时不挤占左侧内容
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.08);

    &__financial {
      flex: none;
      padding: 6px 8px;
    }

    .@{sale-detail-prefix}-footer {
      flex: none;
    }
  }

  // 宽度足够（右列容器 ≥ 620px）：切成左右两栏、宽度对半分，各自内部滚动
  @container (min-width: 620px) {
    .@{sale-detail-prefix}-tmpl-pair {
      flex-direction: row;
      align-items: stretch;

      > .@{sale-detail-prefix}-tmpl-main {
        flex: 1 1 0;
      }
    }

    .@{sale-detail-prefix}-tmpl-money {
      flex: 1 1 0;
      max-height: none;
      border-top: none;
      border-left: 1px solid rgba(255, 255, 255, 0.08);
    }
  }
}

.@{sale-detail-prefix}--phone {
  .@{sale-detail-prefix}-tmpl-b {
    .@{sale-detail-prefix}-tmpl-sider {
      width: 76px;
    }

  }
}

.@{sale-detail-prefix}-tmpl-b--mobile-sheet {
  height: 0;
  overflow: visible;
  background: transparent;
}
