.quotation-editor {
  width: 100%;

  // 加载状态
  .loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;

    .spinner {
      margin-bottom: 16px;
    }

    p {
      color: var(--ion-color-medium);
      margin: 0;
    }
  }

  // 产品管理区域
  .product-management {
    margin-bottom: 20px;

    .product-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 16px 20px;
      background: var(--ion-color-light);
      border-radius: 12px;
      border: 1px solid var(--ion-color-light-shade);

      h3 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: var(--ion-color-dark);
      }

      .product-actions {
        display: flex;
        gap: 12px;

        button {
          display: flex;
          align-items: center;
          gap: 8px;
          padding: 8px 16px;
          border-radius: 8px;
          font-size: 14px;
          font-weight: 500;
          transition: all 0.2s ease;

          .icon {
            width: 16px;
            height: 16px;
          }
        }
      }
    }
  }

  // 空状态
  .empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--ion-color-medium);

    .empty-icon {
      width: 80px;
      height: 80px;
      margin: 0 auto 16px;
      opacity: 0.3;
    }

    .empty-message {
      font-size: 16px;
      font-weight: 500;
      margin: 0 0 8px;
      color: var(--ion-color-dark);
    }

    .empty-hint {
      font-size: 14px;
      margin: 0;
    }
  }

  // 工具栏
  .quotation-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--ion-color-light);
    border-radius: 8px;
    margin-bottom: 16px;

    .toolbar-title {
      font-size: 16px;
      font-weight: 600;
      margin: 0;
      color: var(--ion-color-dark);
    }

    .toolbar-right {
      display: flex;
      gap: 8px;
    }

    .btn-icon {
      padding: 6px;
      background: transparent;
      border: 1px solid var(--ion-color-medium);
      border-radius: 4px;
      cursor: pointer;
      transition: all 0.2s;

      &:hover {
        background: var(--ion-color-light-shade);
        border-color: var(--ion-color-primary);
      }

      .icon {
        width: 18px;
        height: 18px;
        color: var(--ion-color-medium-shade);
      }
    }
  }

  // 卡片视图
  .quotation-spaces {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .space-card {
    border: 1px solid var(--ion-color-light-shade);
    border-radius: 8px;
    background: white;
    overflow: hidden;
    transition: all 0.3s;

    &.expanded {
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);

      .space-header {
        background: var(--ion-color-light);
        border-bottom: 1px solid var(--ion-color-light-shade);
      }

      .space-toggle .icon {
        transform: rotate(180deg);
      }
    }
  }

  .space-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    cursor: pointer;
    transition: background 0.2s;

    &:hover {
      background: var(--ion-color-light-tint);
    }

    .space-info {
      flex: 1;
    }

    .space-name {
      font-size: 16px;
      font-weight: 600;
      margin: 0 0 4px;
      color: var(--ion-color-dark);
    }

    .space-subtotal {
      font-size: 14px;
      margin: 0;
      color: var(--ion-color-primary);
      font-weight: 500;
    }

    .space-toggle {
      .icon {
        width: 20px;
        height: 20px;
        color: var(--ion-color-medium);
        transition: transform 0.3s;
      }
    }
  }

  .space-content {
    padding: 16px;
    animation: slideDown 0.3s ease-out;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  // 工序网格
  .process-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }

  .process-item {
    border: 1px solid var(--ion-color-light-shade);
    border-radius: 6px;
    padding: 12px;
    background: var(--ion-color-light-tint);
    transition: all 0.2s;

    &.enabled {
      border-color: var(--ion-color-primary);
      background: white;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    }

    .process-header {
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      margin-bottom: 8px;

      .checkbox-wrapper {
        display: flex;
        align-items: center;

        .checkbox-input {
          display: none;

          &:checked + .checkbox-custom {
            background: var(--ion-color-primary);
            border-color: var(--ion-color-primary);

            &::after {
              opacity: 1;
            }
          }
        }

        .checkbox-custom {
          width: 18px;
          height: 18px;
          border: 2px solid var(--ion-color-medium);
          border-radius: 4px;
          position: relative;
          transition: all 0.2s;

          &::after {
            content: '';
            position: absolute;
            left: 4px;
            top: 1px;
            width: 5px;
            height: 9px;
            border: solid white;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
            opacity: 0;
            transition: opacity 0.2s;
          }
        }
      }

      .badge {
        padding: 4px 12px;
        border-radius: 12px;
        font-size: 16px;
        font-weight: 700;
        background: white;

        &[data-color="primary"] {
          color: var(--ion-color-primary-tint);
                    border: solid 1px var(--ion-color-primary-tint);
        }

        &[data-color="secondary"] {
          color: var(--ion-color-secondary-tint);
                    border: solid 1px var(--ion-color-secondary-tint);
        }

        &[data-color="tertiary"] {
          color: var(--ion-color-tertiary-tint);
                    border: solid 1px var(--ion-color-tertiary-tint);
        }

        &[data-color="success"] {
          color: var(--ion-color-success-tint);
                    border: solid 1px var(--ion-color-success-tint);
        }
      }
    }

    .process-inputs {
      display: flex;
      flex-direction: column;
      gap: 8px;

      .input-group {
        display: flex;
        flex-direction: column;
        gap: 4px;

        .input-label {
          font-size: 12px;
          color: var(--ion-color-medium-shade);
          font-weight: 500;
        }

        .input-with-note {
          display: flex;
          align-items: center;
          gap: 4px;

          .input-field {
            flex: 1;
            padding: 6px 8px;
            border: 1px solid var(--ion-color-light-shade);
            border-radius: 4px;
            font-size: 14px;

            &:focus {
              outline: none;
              border-color: var(--ion-color-primary);
            }

            &:disabled {
              background: var(--ion-color-light);
              color: var(--ion-color-medium);
            }
          }

          .input-note {
            font-size: 12px;
            color: var(--ion-color-medium);
            white-space: nowrap;
          }
        }
      }

      .process-subtotal {
        padding: 6px 8px;
        background: var(--ion-color-light);
        border-radius: 4px;
        font-size: 13px;
        font-weight: 600;
        color: var(--ion-color-primary);
        text-align: right;
      }
    }
  }

  // 表格视图
  .quotation-table {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }

  .table-section {
    border: 1px solid var(--ion-color-light-shade);
    border-radius: 8px;
    overflow: hidden;
    background: white;

    .table-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 16px;
      background: var(--ion-color-light);
      border-bottom: 1px solid var(--ion-color-light-shade);

      .table-space-name {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        color: var(--ion-color-dark);
      }

      .table-space-subtotal {
        font-size: 14px;
        font-weight: 600;
        color: var(--ion-color-primary);
      }
    }
  }

  .process-table {
    width: 100%;
    border-collapse: collapse;

    thead {
      background: var(--ion-color-light-tint);

      th {
        padding: 10px 12px;
        text-align: left;
        font-size: 13px;
        font-weight: 600;
        color: var(--ion-color-medium-shade);
        border-bottom: 2px solid var(--ion-color-light-shade);

        &.col-checkbox {
          width: 40px;
        }

        &.col-process {
          width: auto;
        }

        &.col-price,
        &.col-quantity {
          width: 120px;
        }

        &.col-unit {
          width: 80px;
        }

        &.col-subtotal {
          width: 120px;
          text-align: right;
        }
      }
    }

    tbody {
      tr {
        border-bottom: 1px solid var(--ion-color-light-shade);
        transition: background 0.2s;

        &:hover {
          background: var(--ion-color-light-tint);
        }

        &.enabled {
          background: rgba(var(--ion-color-primary-rgb), 0.02);

          &:hover {
            background: rgba(var(--ion-color-primary-rgb), 0.05);
          }
        }

        td {
          padding: 12px;
          font-size: 14px;

          &.col-subtotal {
            text-align: right;
          }

          .checkbox-wrapper {
            display: flex;
            align-items: center;
            justify-content: center;

            .checkbox-input {
              display: none;

              &:checked + .checkbox-custom {
                background: var(--ion-color-primary);
                border-color: var(--ion-color-primary);

                &::after {
                  opacity: 1;
                }
              }
            }

            .checkbox-custom {
              width: 18px;
              height: 18px;
              border: 2px solid var(--ion-color-medium);
              border-radius: 4px;
              position: relative;
              transition: all 0.2s;
              cursor: pointer;

              &::after {
                content: '';
                position: absolute;
                left: 4px;
                top: 1px;
                width: 5px;
                height: 9px;
                border: solid white;
                border-width: 0 2px 2px 0;
                transform: rotate(45deg);
                opacity: 0;
                transition: opacity 0.2s;
              }
            }
          }

          .table-input {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid var(--ion-color-light-shade);
            border-radius: 4px;
            font-size: 14px;

            &:focus {
              outline: none;
              border-color: var(--ion-color-primary);
            }

            &:disabled {
              background: var(--ion-color-light);
              color: var(--ion-color-medium);
            }
          }

          .disabled-value {
            color: var(--ion-color-medium);
          }
        }
      }
    }
  }

  // 总价
  .quotation-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--ion-color-primary) 0%, var(--ion-color-primary-shade) 100%);
    border-radius: 8px;
    margin-top: 16px;

    .total-label {
      font-size: 16px;
      font-weight: 500;
      color: white;
    }

    .total-amount {
      font-size: 24px;
      font-weight: 700;
      color: white;
    }
  }

  // ============ 产品相关样式 ============

  // 产品卡片
  .quotation-products {
    .product-card {
      border: 1px solid var(--ion-color-light-shade);
      border-radius: 12px;
      margin-bottom: 16px;
      background: white;
      overflow: hidden;
      transition: all 0.3s ease;

      &.expanded {
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
      }

      .product-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        cursor: pointer;
        user-select: none;
        transition: background-color 0.2s;

        &:hover {
          background-color: var(--ion-color-light-tint);
        }

        .product-info {
          display: flex;
          align-items: center;
          gap: 16px;
          flex: 1;

          .product-title {
            display: flex;
            align-items: center;
            gap: 12px;

            .product-icon {
              width: 40px;
              height: 40px;
              display: flex;
              align-items: center;
              justify-content: center;
              background: var(--ion-color-primary-tint);
              border-radius: 10px;
              color: var(--ion-color-primary);
              font-size: 20px;
            }

            .product-details {
              .product-name {
                font-size: 18px;
                font-weight: 600;
                color: var(--ion-color-dark);
                margin: 0 0 4px;
              }

              .product-meta {
                display: flex;
                align-items: center;
                gap: 8px;

                .badge {
                  font-size: 12px;
                  padding: 2px 8px;
                  border-radius: 12px;
                  font-weight: 500;
                }

                .designer-name {
                  font-size: 13px;
                  color: var(--ion-color-medium);
                }
              }
            }
          }

          .product-pricing {
            text-align: right;

            .product-subtotal {
              font-size: 20px;
              font-weight: 700;
              color: var(--ion-color-primary);
              margin: 0 0 2px;
            }

            .percentage {
              font-size: 13px;
              color: var(--ion-color-medium);
            }
          }
        }

        .product-actions {
          display: flex;
          align-items: center;
          gap: 8px;

          .btn-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            border: none;
            background: var(--ion-color-light-tint);
            color: var(--ion-color-medium);
            cursor: pointer;
            transition: all 0.2s;

            &:hover {
              background: var(--ion-color-light-shade);
              color: var(--ion-color-dark);
            }

            &.danger:hover {
              background: var(--ion-color-danger-tint);
              color: var(--ion-color-danger);
            }

            .icon {
              width: 16px;
              height: 16px;
            }
          }

          .product-toggle {
            margin-left: 8px;
            color: var(--ion-color-medium);
            transition: transform 0.3s ease;

            .icon {
              width: 20px;
              height: 20px;
            }
          }
        }
      }

      .product-card.expanded .product-toggle {
        transform: rotate(180deg);
      }

      .product-content {
        border-top: 1px solid var(--ion-color-light-shade);
        animation: slideDown 0.3s ease-out;
      }

      .product-details-section {
        padding: 16px 20px;
        background: var(--ion-color-light-tint);
        border-bottom: 1px solid var(--ion-color-light-shade);

        .detail-item {
          display: flex;
          justify-content: space-between;
          align-items: center;
          margin-bottom: 8px;

          &:last-child {
            margin-bottom: 0;
          }

          .detail-label {
            font-size: 14px;
            color: var(--ion-color-medium);
          }

          .detail-value {
            font-size: 14px;
            font-weight: 500;
            color: var(--ion-color-dark);
          }
        }
      }
    }
  }

  // 报价汇总
  .quotation-summary {
    background: white;
    border: 1px solid var(--ion-color-light-shade);
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;

    .summary-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 16px;

      h4 {
        margin: 0;
        font-size: 18px;
        font-weight: 600;
        color: var(--ion-color-dark);
      }

      .breakdown-toggle {
        .btn-text {
          background: none;
          border: none;
          color: var(--ion-color-primary);
          font-size: 14px;
          cursor: pointer;
          padding: 4px 8px;
          border-radius: 4px;
          transition: background-color 0.2s;

          &:hover {
            background-color: var(--ion-color-primary-tint);
          }
        }
      }
    }

    // 内部执行分配区域
    .allocation-section {
      margin-top: 20px;
      padding-top: 20px;
      border-top: 1px solid var(--ion-color-light-shade);

      .allocation-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 16px;

        h4 {
          margin: 0;
          font-size: 16px;
          font-weight: 600;
          color: var(--ion-color-dark);
        }

        .btn-text {
          background: none;
          border: none;
          color: var(--ion-color-primary);
          font-size: 14px;
          cursor: pointer;
          padding: 4px 8px;
          border-radius: 4px;
          transition: background-color 0.2s;

          &:hover {
            background-color: var(--ion-color-primary-tint);
          }
        }
      }

      .allocation-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 16px;

        .allocation-item {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 16px;
          border-radius: 10px;
          border-left: 4px solid;
          background: var(--ion-color-light-tint);
          transition: all 0.2s ease;

          &:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
          }

          &.modeling {
            border-left-color: #8B5CF6; // 紫色 - 建模
            background: rgba(139, 92, 246, 0.05);

            .allocation-icon {
              background: rgba(139, 92, 246, 0.1);
              color: #8B5CF6;
            }
          }

          &.decoration {
            border-left-color: #F59E0B; // 橙色 - 软装渲染
            background: rgba(245, 158, 11, 0.05);

            .allocation-icon {
              background: rgba(245, 158, 11, 0.1);
              color: #F59E0B;
            }
          }

          &.company {
            border-left-color: #10B981; // 绿色 - 公司分配
            background: rgba(16, 185, 129, 0.05);

            .allocation-icon {
              background: rgba(16, 185, 129, 0.1);
              color: #10B981;
            }
          }

          .allocation-icon {
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            flex-shrink: 0;

            .icon {
              width: 24px;
              height: 24px;
            }
          }

          .allocation-info {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;

            .allocation-name {
              font-size: 15px;
              font-weight: 600;
              color: var(--ion-color-dark);
              line-height: 1.2;
            }

            .allocation-desc {
              font-size: 12px;
              color: var(--ion-color-medium);
              line-height: 1.3;
            }
          }

          .allocation-values {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 2px;

            .allocation-percentage {
              font-size: 13px;
              font-weight: 500;
              color: var(--ion-color-medium-shade);
              background: rgba(0, 0, 0, 0.04);
              padding: 2px 8px;
              border-radius: 12px;
              min-width: 45px;
              text-align: center;
            }

            .allocation-amount {
              font-size: 20px;
              font-weight: 700;
              color: var(--ion-color-dark);
              line-height: 1.2;
            }
          }
        }
      }

      .allocation-note {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 16px;
        background: rgba(56, 128, 255, 0.08);
        border-radius: 8px;
        border-left: 3px solid var(--ion-color-primary);

        .icon {
          width: 18px;
          height: 18px;
          color: var(--ion-color-primary);
          flex-shrink: 0;
          margin-top: 2px;
        }

        span {
          flex: 1;
          font-size: 13px;
          color: var(--ion-color-medium-shade);
          line-height: 1.5;
        }
      }
    }

    .breakdown-list {
      margin-bottom: 16px;

      .breakdown-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--ion-color-light-tint);

        &:last-child {
          border-bottom: none;
        }

        .breakdown-name {
          flex: 1;
          font-size: 14px;
          color: var(--ion-color-dark);
        }

        .breakdown-amount {
          font-size: 15px;
          font-weight: 600;
          color: var(--ion-color-dark);
          margin: 0 16px;
        }

        .breakdown-percentage {
          font-size: 13px;
          color: var(--ion-color-medium);
          min-width: 50px;
          text-align: right;
        }
      }
    }

    .total-section {
      .total-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 0;
        border-top: 2px solid var(--ion-color-primary);
        background: linear-gradient(135deg, var(--ion-color-primary) 0%, var(--ion-color-primary-shade) 100%);
        margin: 0 -20px 0px;
        padding: 16px 20px;

        .total-label {
          font-size: 16px;
          font-weight: 500;
          color: white;
        }

        .total-amount {
          font-size: 24px;
          font-weight: 700;
          color: white;
        }
      }

      .total-meta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 8px;
        font-size: 12px;
        color: var(--ion-color-medium);

        .generate-info,
        .valid-info {
          display: flex;
          align-items: center;
          gap: 4px;
        }
      }
    }
  }

  // 兼容性 - 保持原有space类名
  .quotation-spaces {
    @extend .quotation-products;
  }

  .space-card {
    @extend .product-card;
  }

  .space-header {
    @extend .product-header;
  }

  .space-content {
    @extend .product-content;
  }

  // 移动端适配
  @media (max-width: 768px) {
    .allocation-section {
      .allocation-list {
        .allocation-item {
          flex-wrap: nowrap;
          padding: 14px;

          .allocation-icon {
            width: 40px;
            height: 40px;

            .icon {
              width: 20px;
              height: 20px;
            }
          }

          .allocation-info {
            flex: 1;
            min-width: 120px;

            .allocation-name {
              font-size: 14px;
            }

            .allocation-desc {
              font-size: 11px;
            }
          }

          .allocation-values {
            width: 100%;
            flex-direction: row;
            justify-content: space-between;
            align-items: center;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid rgba(0, 0, 0, 0.06);

            .allocation-percentage {
              font-size: 12px;
            }

            .allocation-amount {
              font-size: 18px;
            }
          }
        }
      }

      .allocation-note {
        padding: 10px 12px;

        .icon {
          width: 16px;
          height: 16px;
        }

        span {
          font-size: 12px;
        }
      }
    }

    .product-content .process-grid {
      grid-template-columns: 1fr;
    }
  }
}

// ============ 模态框样式 ============

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-container {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;

  h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
  }

  .close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #6b7280;

    &:hover {
      background: #f3f4f6;
      color: #111827;
    }

    &:active {
      transform: scale(0.95);
    }

    .icon {
      width: 20px;
      height: 20px;
    }
  }
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;

  &::-webkit-scrollbar {
    width: 8px;
  }

  &::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;

    &:hover {
      background: #9ca3af;
    }
  }
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;

  button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;

    &.btn-secondary {
      background: #f3f4f6;
      color: #374151;

      &:hover {
        background: #e5e7eb;
      }
    }

    &.btn-primary {
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      color: white;

      &:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
      }

      &:disabled {
        opacity: 0.5;
        cursor: not-allowed;
      }
    }

    &:active:not(:disabled) {
      transform: scale(0.98);
    }
  }
}

// ============ 表单样式 ============

.form-group {
  margin-bottom: 20px;

  .form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
  }

  .form-input,
  .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    transition: all 0.2s ease;
    outline: none;
    background: white;

    &:focus {
      border-color: #667eea;
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

    &::placeholder {
      color: #9ca3af;
    }
  }

  .form-select {
    cursor: pointer;
  }

  .input-with-hint {
    .input-hint {
      display: block;
      margin-top: 6px;
      font-size: 12px;
      color: #6b7280;
    }
  }

  .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background 0.2s ease;

    &:hover {
      background: #f9fafb;
    }

    input[type="checkbox"] {
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: #667eea;
    }

    span {
      font-size: 14px;
      color: #374151;
      user-select: none;
    }
  }

  .radio-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;

    .radio-label {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 10px 16px;
      border: 1.5px solid #e5e7eb;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.2s ease;
      background: white;

      &:hover {
        border-color: #667eea;
        background: #f5f7ff;
      }

      input[type="radio"] {
        cursor: pointer;
        accent-color: #667eea;
      }

      span {
        font-size: 14px;
        color: #374151;
        user-select: none;
      }

      &:has(input:checked) {
        border-color: #667eea;
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
        font-weight: 500;
      }
    }
  }
}

// ============ 场景选择网格 ============

.scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;

  .scene-card {
    padding: 16px 12px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;

    &:hover {
      border-color: #667eea;
      background: #f5f7ff;
      transform: translateY(-2px);
      box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    }

    &:active {
      transform: translateY(0);
    }

    &.selected {
      border-color: #667eea;
      background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
      box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);

      .scene-name {
        color: #667eea;
        font-weight: 600;
      }
    }

    &.custom {
      border-style: dashed;
      border-color: #9ca3af;
      color: #6b7280;

      &:hover {
        border-color: #667eea;
        border-style: solid;
      }

      &.selected {
        border-style: solid;
        border-color: #667eea;
        color: #667eea;
      }
    }

    .scene-name {
      font-size: 13px;
      font-weight: 500;
      color: #374151;
      transition: all 0.2s ease;
    }
  }
}

// ============ 加价规则配置 ============

.pricing-adjustments {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 12px;
  border: 1px solid #e5e7eb;

  .section-title {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
  }

  .form-group {
    margin-bottom: 16px;

    &:last-child {
      margin-bottom: 0;
    }
  }
}

// ============ 价格预览 ============

.price-preview {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-radius: 12px;
  border: 2px solid #fbbf24;

  .price-preview-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;

    &.adjustment {
      color: #f59e0b;
      font-weight: 500;

      .price {
        color: #f59e0b;
      }
    }

    &.total {
      margin-top: 8px;
      padding-top: 12px;
      border-top: 2px solid rgba(251, 191, 36, 0.3);
      font-size: 16px;
      font-weight: 600;

      .price {
        font-size: 24px;
        color: #d97706;
      }
    }

    .label {
      color: #92400e;
      font-weight: 500;
    }

    .price {
      font-weight: 600;
      color: #92400e;
    }
  }
}

// ============ 内部分配小卡片 ============

.allocation-mini {
  margin-top: 20px;
  padding: 16px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-radius: 10px;
  border: 1px solid #86efac;

  .section-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #166534;
  }

  .allocation-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;

    .allocation-mini-item {
      padding: 10px 12px;
      background: white;
      border-radius: 8px;
      border-left: 3px solid;
      display: flex;
      flex-direction: column;
      gap: 4px;

      &.modeling {
        border-left-color: #8b5cf6;
      }

      &.decoration {
        border-left-color: #f59e0b;
      }

      &.company {
        border-left-color: #10b981;
      }

      .label {
        font-size: 11px;
        color: #6b7280;
        font-weight: 500;
      }

      .value {
        font-size: 14px;
        font-weight: 600;
        color: #111827;
      }
    }
  }
}

// ============ 分配明细网格样式 ============

.allocation-section-detail {
  margin-top: 20px;

  .section-title {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;

    .section-subtitle {
      font-size: 13px;
      font-weight: 400;
      color: #6b7280;
      margin-left: 8px;
    }
  }

  .allocation-grid-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;

    .allocation-item-detail {
      border: 1.5px solid #e5e7eb;
      border-radius: 10px;
      padding: 14px 16px;
      background: white;
      transition: all 0.2s ease;

      &:not(.enabled) {
        opacity: 0.5;
        background: #f9fafb;
      }

      &.enabled {
        border-left-width: 4px;
      }

      &[data-type="modeling"].enabled {
        border-left-color: #8b5cf6;
        background: linear-gradient(90deg, rgba(139, 92, 246, 0.03) 0%, white 100%);
      }

      &[data-type="decoration"].enabled {
        border-left-color: #f59e0b;
        background: linear-gradient(90deg, rgba(245, 158, 11, 0.03) 0%, white 100%);
      }

      &[data-type="company"].enabled {
        border-left-color: #10b981;
        background: linear-gradient(90deg, rgba(16, 185, 129, 0.03) 0%, white 100%);
      }

      .allocation-header-detail {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;

        .allocation-left {
          display: flex;
          align-items: center;
          gap: 12px;
          flex: 1;

          .checkbox-wrapper {
            display: flex;
            align-items: center;

            .checkbox-input {
              width: 18px;
              height: 18px;
              cursor: pointer;
              accent-color: #667eea;
            }

            .checkbox-custom {
              display: none;
            }
          }

          .allocation-info-detail {
            display: flex;
            flex-direction: column;
            gap: 4px;

            .allocation-name-detail {
              font-size: 15px;
              font-weight: 600;
              color: #111827;
            }

            .allocation-desc-detail {
              font-size: 12px;
              color: #6b7280;
            }
          }
        }

        .allocation-percentage-badge {
          padding: 4px 12px;
          background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
          color: white;
          border-radius: 16px;
          font-size: 13px;
          font-weight: 600;
        }
      }

      .allocation-input-section {
        padding-left: 30px;

        .input-label-small {
          display: block;
          margin-bottom: 8px;
          font-size: 13px;
          font-weight: 500;
          color: #374151;
        }

        .input-with-currency {
          position: relative;
          display: flex;
          align-items: center;

          .currency-symbol {
            position: absolute;
            left: 14px;
            font-size: 14px;
            font-weight: 600;
            color: #6b7280;
            pointer-events: none;
          }

          .amount-input {
            width: 100%;
            padding: 10px 14px 10px 32px;
            border: 1.5px solid #e5e7eb;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            color: #111827;
            transition: all 0.2s ease;
            outline: none;

            &:focus {
              border-color: #667eea;
              box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
            }

            &:disabled {
              background: #f3f4f6;
              cursor: not-allowed;
            }
          }
        }

        .allocation-hint {
          margin-top: 6px;
          font-size: 12px;
          color: #6b7280;
          padding-left: 2px;
        }
      }
    }
  }
}

// ============ 移动端适配（模态框） ============

@media (max-width: 768px) {
  .modal-container {
    max-width: none;
    width: 100%;
    max-height: 95vh;
    margin: 0;
    border-radius: 16px 16px 0 0;
  }

  .modal-header {
    padding: 16px 20px;

    h3 {
      font-size: 18px;
    }
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 12px 20px;

    button {
      flex: 1;
      padding: 12px;
    }
  }

  .scene-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;

    .scene-card {
      padding: 12px 8px;

      .scene-name {
        font-size: 12px;
      }
    }
  }

  .form-group .radio-group {
    flex-direction: column;

    .radio-label {
      width: 100%;
    }
  }

  .allocation-mini .allocation-mini-grid {
    grid-template-columns: 1fr;
  }

  .price-preview {
    padding: 16px;

    .price-preview-row.total .price {
      font-size: 20px;
    }
  }
}
