.baseCapabilityEditor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--surface);
  color: var(--text-normal);
  font-size: var(--font-size-sm);
}

.baseCapabilityEditor > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-strong);
}

.baseCapabilityEditor > header strong {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.baseCapabilityEditor > header span,
.capabilityFormPanel > header small,
.capabilityListItem small,
.capabilityFormRow small,
.capabilityPreserveNote span {
  color: var(--text-soft);
  font-size: var(--font-size-xs);
}

.baseCapabilityEditor > header span,
.capabilityFormPanel > header strong,
.capabilityFormPanel > header small {
  display: block;
}

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

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

.capabilitySidebarTitle,
.capabilityFormGroup > header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-strong);
  font-weight: var(--font-weight-medium);
}

.capabilityList,
.capabilityAddBox,
.capabilityFormRows {
  display: grid;
  gap: 6px;
}

.capabilityListItem {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  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;
}

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

.capabilityListItem span,
.capabilityFormRow > div,
.capabilityPreserveNote {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.capabilityListItem strong,
.capabilityListItem small,
.capabilityFormRow strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capabilityFormRow small {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.45;
}

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

.capabilityAddBox {
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.capabilitySummary {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  align-content: start;
}

.capabilitySummary strong {
  color: var(--text-strong);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.capabilitySummary p {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--font-size-xs);
  line-height: 1.65;
}

.capabilityFormPanel {
  background: var(--surface);
}

.capabilityFormPanel > header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.capabilityFormPanel > header strong {
  color: var(--text-strong);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.capabilityFormPanel > header span {
  width: fit-content;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.capabilityFormGroup {
  padding: 0;
  overflow: hidden;
  background: var(--surface);
}

.capabilityFormGroup > header {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface);
}

.capabilityFormRows {
  padding: 8px 10px;
}

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

.capabilitySwitch {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text-normal);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.capabilityBooleanSelect {
  width: fit-content;
  min-width: 154px;
}

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

.capabilityScopedControl,
.capabilityScopedRows {
  display: grid;
  gap: 6px;
}

.capabilitySegmented {
  display: inline-flex;
  width: fit-content;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--control-radius);
  background: var(--surface-muted);
}

.capabilitySegmented button {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: calc(var(--control-radius) - 2px);
  background: transparent;
  color: var(--text-soft);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.capabilitySegmented button[data-active="true"] {
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.08);
}

.capabilitySegmented button:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}

.capabilityScopedRow {
  display: grid;
  grid-template-columns: minmax(150px, 0.42fr) minmax(0, 1fr) 30px;
  gap: 6px;
  align-items: center;
}

.capabilityMultiValue,
.capabilityMultiOptions,
.capabilityCustomValue {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

.capabilityMultiValue {
  flex-wrap: wrap;
}

.capabilityMultiOptions {
  flex-wrap: wrap;
}

.capabilityCheckboxOption {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 0;
  color: var(--text-normal);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.capabilityCustomValue {
  flex: 1 1 210px;
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 8px;
}

.capabilityCustomValue .shInput {
  min-width: 120px;
}

.capabilityAddValueButton {
  min-width: 64px;
  white-space: nowrap;
}

.capabilityPreserveNote {
  padding: 8px;
  border: 1px dashed #dce2ea;
  border-radius: var(--control-radius);
  background: var(--surface);
}

@media (max-width: 980px) {
  .capabilityWorkbench,
  .capabilityFormRow,
  .capabilityFormPanel > header,
  .capabilityScopedRow {
    grid-template-columns: 1fr;
  }
}
