.filterField {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--color-fg-default);
}

.filterField.sm {
  min-block-size: var(--component-size-sm);
}

.filterField.md {
  min-block-size: var(--component-size-md);
}

.filterField.lg {
  min-block-size: var(--component-size-lg);
}

.label {
  display: flex;
  align-items: center;
  align-self: stretch;
  flex: 0 0 auto;
  min-width: 0;
  padding-inline: var(--spacing-sm) 2px;
  padding-block: 0;
  color: var(--color-fg-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-default);
  line-height: var(--line-height-normal);
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}

.controlGroup {
  display: inline-flex;
  align-items: stretch;
  min-width: 9rem;
  max-width: 100%;
  flex: 1 1 auto;
  overflow: hidden;
  position: relative;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--border-radius-default);
  box-shadow: var(--shadow-xs);
  transition:
    background-color var(--transition-fast) var(--ease-standard),
    border-color var(--transition-fast) var(--ease-standard),
    box-shadow var(--transition-fast) var(--ease-standard);
}

.surface .controlGroup:hover:not(.disabled) {
  border-color: var(--color-border-default);
  box-shadow: var(--shadow-sm);
}

.outlined .controlGroup {
  box-shadow: none;
}

.outlined .controlGroup:hover:not(.disabled) {
  border-color: var(--color-border-default);
}

.subtle .controlGroup {
  background: var(--color-bg-toolbar);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px transparent;
}

.subtle .controlGroup:hover:not(.disabled) {
  background: var(--color-bg-surface-strong);
}

.filterField.active .controlGroup {
  background: var(--color-bg-surface);
  border-color: var(--color-border-strong);
}

.subtle.active .controlGroup {
  background: var(--color-bg-toolbar);
  border-color: color-mix(in srgb, var(--color-border-strong) 75%, transparent);
}

.filterField.active .label,
.filterField.active .operatorTrigger,
.filterField.active .valueWrapper {
  color: var(--color-fg-default);
}

.invalid {
  border-color: var(--color-status-danger-border);
}

.invalid:focus-within {
  border-color: var(--color-status-danger-border);
}

.disabled {
  background: var(--color-disabled-bg);
  border-color: var(--color-disabled-border);
  box-shadow: none;
}

.operatorWrapper {
  display: flex;
  align-items: stretch;
  flex: 0 0 auto;
  min-width: 0;
  position: relative;
}

.operatorWrapper::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 0;
  width: 1px;
  height: 1rem;
  background: color-mix(in srgb, var(--color-border-subtle) 70%, transparent);
  pointer-events: none;
}

.operatorWrapper:focus-within::after {
  opacity: 0;
}

.operatorTrigger.operatorTrigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  min-width: 0;
  padding-inline: var(--spacing-xxs);
  color: var(--color-fg-muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-family);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-default);
  line-height: 1;
  transition:
    background-color var(--transition-fast) var(--ease-standard),
    color var(--transition-fast) var(--ease-standard),
    box-shadow var(--transition-fast) var(--ease-standard);
}

.operatorTrigger:hover:not(:disabled) {
  color: var(--color-fg-default);
  background: color-mix(in srgb, var(--color-bg-hover-subtle) 45%, transparent);
}

.operatorTrigger:focus-visible,
.operatorTriggerOpen {
  position: relative;
  z-index: 1;
  color: var(--color-fg-default);
  background: color-mix(in srgb, var(--color-bg-hover-subtle) 55%, transparent);
  box-shadow: inset 0 0 0 1px var(--color-field-focus);
  outline: none;
}

.operatorTrigger:disabled,
.operatorTrigger[aria-disabled='true'] {
  cursor: not-allowed;
  color: var(--color-disabled-fg);
  background: transparent;
}

.operatorTrigger svg {
  flex: 0 0 auto;
  inline-size: var(--component-size-xxs);
  block-size: var(--component-size-xxs);
  color: currentColor;
}

.operatorText {
  white-space: nowrap;
}

.valueWrapper {
  display: flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 10rem;
  position: relative;
}

.valueWrapper:focus-within {
  box-shadow: inset 0 0 0 1px var(--color-field-focus);
}

.invalid .valueWrapper:focus-within {
  box-shadow: inset 0 0 0 1px var(--color-status-danger-border);
}

.valueWrapper > * {
  min-width: 0;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

.valueWrapper > div {
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  height: 100%;
}

.valueWrapper.autoWidth {
  width: auto;
  flex: 1 1 auto;
}

.valueWrapper.autoWidth > * {
  width: auto;
  max-width: 100%;
}

.valueWrapper.autoWidth > div {
  width: auto;
  max-width: 100%;
}

.valueWrapper .field {
  min-height: unset;
  height: 100%;
  block-size: 100%;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  background: transparent;
  border: none;
  box-shadow: none;
}

.embeddedInputField {
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
  padding-inline: 10px var(--spacing-xs);
}

.embeddedInputElement {
  flex: 1 1 auto;
  inline-size: 100%;
  width: 100%;
  min-width: 0;
  height: 100%;
  block-size: 100%;
  min-height: unset;
  background: transparent;
  border: none;
  box-shadow: none;
  padding-block: 0;
  padding-inline: 0;
  margin: 0;
  box-sizing: border-box;
}

.filterField.active .embeddedInputElement {
  font-weight: 600;
}

.filterField.active .embeddedInputElement::placeholder {
  font-weight: var(--font-weight-default);
}

.valueWrapper .startAdornment {
  margin-left: 0;
  gap: 2px;
  min-width: 0;
}

.valueWrapper [data-input-role='clear'] {
  color: var(--color-fg-muted);
  background: transparent;
}

.valueWrapper [data-input-role='clear']:hover {
  background: color-mix(in srgb, var(--color-bg-hover-subtle) 50%, transparent);
}

.filterField input {
  min-width: 0;
  height: 100%;
}

.filterField input::placeholder {
  color: var(--color-fg-subtle);
}
