.pricingRuleGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pricingRuleCard {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pricingRuleCard header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pricingRuleCard strong,
.pricingRuleCard span {
  display: block;
}

.pricingRuleCard header span,
.pricingRuleCard p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.pricingRuleItems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.pricingRuleItems span {
  display: grid;
  gap: 4px;
  min-height: 56px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  color: #4b5563;
  font-size: 0.75rem;
}

.pricingRuleItems strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-strong);
  font-size: 0.8125rem;
}

.pricingRuleItems svg {
  color: var(--text-soft);
}

.pricingRuleItems em {
  color: var(--muted-foreground);
  font-style: normal;
  line-height: 1.35;
}

.pricingRuleDialog {
  width: min(1120px, 100%);
}

.pricingRuleFormBody {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pricingModeEditor,
.pricingModeRule,
.pricingWeightStack {
  display: grid;
  gap: 14px;
}

.pricingModeHeader,
.pricingModeRule header,
.pricingWeightTable header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pricingModeHeader strong,
.pricingModeRule strong,
.pricingWeightTable strong {
  display: block;
  font-size: 0.875rem;
}

.pricingModeHeader span,
.pricingModeRule header span {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.pricingModeTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  border-bottom: 1px solid var(--border);
}

.pricingModeTabs button {
  min-height: 40px;
  padding: 0 2px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.875rem;
  font-weight: var(--font-weight-semibold);
}

.pricingModeTabs button.active {
  border-bottom-color: var(--primary);
  color: var(--text-strong);
}

.pricingModeWorkbench {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.pricingModeSidebar,
.pricingModePanel {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  background: var(--surface);
}

.pricingModeSidebarTitle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong);
  font-weight: var(--font-weight-medium);
}

.pricingModeList {
  display: grid;
  gap: 6px;
}

.pricingModeList button {
  display: grid;
  min-height: 44px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--text-strong);
  text-align: left;
}

.pricingModeList button[data-active="true"] {
  border-color: var(--ring);
  background: #fff;
  box-shadow: 0 0 0 1px var(--ring);
}

.pricingModeList span,
.pricingModeSummary {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.pricingModeList strong,
.pricingModeSummary strong {
  color: var(--text-strong);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.pricingModeList small,
.pricingModeSummary p {
  color: var(--text-soft);
  font-size: var(--font-size-xs);
}

.pricingModeSummary {
  min-height: 86px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  align-content: start;
}

.pricingModeSummary p {
  margin: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.pricingModeRule,
.pricingModeEmpty {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pricingModeEmpty {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.pricingModeRule header > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.pricingModeRule header span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pricingModeBaseRows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pricingModeBaseRows.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pricingModeInlineRows {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pricingTextPriceGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pricingFormRows {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  background: var(--surface);
}

.pricingFormRow {
  display: grid;
  grid-template-columns: minmax(112px, 148px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 30px;
}

.pricingFormRow > strong {
  min-width: 0;
  overflow: hidden;
  color: var(--text-strong);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pricingFormReadonly {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  color: var(--text-normal);
  font-size: var(--font-size-sm);
}

.pricingModeInlineInput,
.pricingInlineField {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pricingModeInlineInput span,
.pricingInlineField span {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-normal);
  font-size: 0.75rem;
  font-weight: var(--font-weight-medium);
  line-height: 1.35;
}

.pricingModeInlineInput input,
.pricingModeInlineInput select,
.pricingInlineField input,
.pricingInlineField select {
  border: 0;
  border-radius: 0;
}

.pricingInlineReadonly strong {
  display: flex;
  min-height: 40px;
  align-items: center;
  padding: 0 12px;
  color: var(--text-strong);
  font-size: 0.8125rem;
}

.pricingFormulaBox {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text-normal);
}

.pricingFormulaBox p {
  margin-top: 8px;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-medium);
}

.pricingFormulaBox input {
  margin-top: 8px;
}

.pricingWeightTable {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pricingWeightTable header {
  min-height: 36px;
  padding: 0 12px;
  background: var(--surface-muted);
}

.pricingWeightRows {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px;
}

.pricingWeightRow {
  display: grid;
  grid-template-columns: minmax(100px, 150px) minmax(82px, 120px) 32px;
  gap: 6px;
  align-items: center;
}

.pricingWeightRow.locked {
  grid-template-columns: minmax(112px, 150px) minmax(82px, 120px);
}

.pricingFactorLabel {
  display: flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-subtle);
  color: var(--text-normal);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-medium);
}

.pricingInlineAdd {
  border-style: dashed;
}

@media (max-width: 860px) {
  .pricingRuleGrid,
  .pricingModeWorkbench,
  .pricingModeBaseRows,
  .pricingRuleFormBody,
  .pricingModeInlineRows,
  .pricingModeInlineInput,
  .pricingInlineField,
  .pricingFormRow,
  .pricingTextPriceGrid {
    grid-template-columns: 1fr;
  }
}
